1.8 KiB
1.8 KiB
layout, page_title, sidebar_current, description
| layout | page_title | sidebar_current | description |
|---|---|---|---|
| boundary | Boundary: role_resource | docs-boundary-role-resource | Role resource for the Boundary Terraform provider. |
role_resource
The role resource allows you to configure a Boundary role.
Example Usage
Basic usage:
resource "boundary_role" "example" {
name = "My role"
description = "My first role!"
}
Usage with a user resource:
resource "boundary_user" "foo" {
name = "User 1"
}
resource "boundary_user" "bar" {
name = "User 2"
}
resource "boundary_role" "example" {
name = "My role"
description = "My first role!"
principals = [boundary_user.foo.id, boundary_user.bar.id]
}
Usage with user and grants resource:
resource "boundary_user" "readonly" {
name = "readonly"
description = "A readonly user"
}
resource "boundary_role" "readonly" {
name = "readonly"
description = "A readonly role"
principals = [boundary_user.readonly.id]
grants = ["id=*;action=read"]
}
Usage for a project-specific role:
resource "boundary_project" "foo" {
name = "foo_project"
}
resource "boundary_user" "readonly" {
name = "readonly"
description = "A readonly user"
}
resource "boundary_role" "readonly" {
name = "readonly"
description = "A readonly role"
principals = [boundary_user.readonly.id]
grants = ["id=*;action=read"]
scope_id = boundary_project.foo.id
}
Argument Reference
The following arguments are optional:
description- The role description.grants- A list of stringified grants for the role.name- The role name. Defaults to the resource name.principals- A list of principal (user or group) IDs to add as principals on the role.scope_id- The scope ID in which the resource is created. Defaults to the provider'sdefault_scopeif unset.