Files
terraform-provider-threshold/website/docs/r/resource_role.html.markdown
T

85 lines
1.8 KiB
Markdown
Raw Normal View History

2020-07-02 14:23:56 -07:00
---
2020-08-11 16:12:26 -07:00
layout: "boundary"
page_title: "Boundary: role_resource"
sidebar_current: "docs-boundary-role-resource"
2020-07-02 14:23:56 -07:00
description: |-
2020-08-11 16:12:26 -07:00
Role resource for the Boundary Terraform provider.
2020-07-02 14:23:56 -07:00
---
# role_resource
2020-08-11 16:12:26 -07:00
The role resource allows you to configure a Boundary role.
2020-07-02 14:23:56 -07:00
## Example Usage
2020-07-10 15:32:44 -07:00
Basic usage:
2020-07-02 14:23:56 -07:00
```hcl
2020-08-11 16:12:26 -07:00
resource "boundary_role" "example" {
2020-07-02 14:23:56 -07:00
name = "My role"
description = "My first role!"
}
```
2020-07-10 15:32:44 -07:00
Usage with a user resource:
```hcl
2020-08-11 16:12:26 -07:00
resource "boundary_user" "foo" {
2020-07-10 15:32:44 -07:00
name = "User 1"
}
2020-08-11 16:12:26 -07:00
resource "boundary_user" "bar" {
2020-07-10 15:32:44 -07:00
name = "User 2"
}
2020-08-11 16:12:26 -07:00
resource "boundary_role" "example" {
2020-07-10 15:32:44 -07:00
name = "My role"
description = "My first role!"
2020-08-11 16:12:26 -07:00
principals = [boundary_user.foo.id, boundary_user.bar.id]
2020-07-12 15:00:16 -07:00
}
```
Usage with user and grants resource:
```hcl
2020-08-11 16:12:26 -07:00
resource "boundary_user" "readonly" {
2020-07-12 15:00:16 -07:00
name = "readonly"
description = "A readonly user"
}
2020-08-11 16:12:26 -07:00
resource "boundary_role" "readonly" {
2020-07-12 15:00:16 -07:00
name = "readonly"
description = "A readonly role"
2020-08-11 16:12:26 -07:00
principals = [boundary_user.readonly.id]
2020-07-12 15:00:16 -07:00
grants = ["id=*;action=read"]
2020-07-10 15:32:44 -07:00
}
```
Usage for a project-specific role:
```hcl
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
}
```
2020-07-02 14:23:56 -07:00
## 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.
2020-08-11 16:12:26 -07:00
* `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's `default_scope` if unset.