Files
terraform-provider-threshold/docs/resources/role.md
T

145 lines
3.5 KiB
Markdown
Raw Normal View History

2020-07-02 14:23:56 -07:00
---
2020-10-06 20:34:16 -04:00
page_title: "boundary_role Resource - terraform-provider-boundary"
subcategory: ""
2020-07-02 14:23:56 -07:00
description: |-
2020-10-06 20:34:16 -04:00
The role resource allows you to configure a Boundary role.
2020-07-02 14:23:56 -07:00
---
2020-10-06 20:34:16 -04:00
# Resource `boundary_role`
The role resource allows you to configure a Boundary role.
2020-07-02 14:23:56 -07:00
## Example Usage
2020-10-06 20:34:16 -04:00
2020-07-10 15:32:44 -07:00
Basic usage:
2020-07-02 14:23:56 -07:00
2020-10-06 20:34:16 -04:00
```terraform
2020-09-17 15:34:00 -07:00
resource "boundary_scope" "org" {
2020-10-13 23:12:03 -04:00
name = "organization_one"
description = "My first scope!"
scope_id = "global"
auto_create_admin_role = true
auto_create_default_role = true
2020-09-17 15:34:00 -07:00
}
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-09-17 15:34:00 -07:00
scope_id = boundary_scope.org.id
2020-07-02 14:23:56 -07:00
}
```
2020-07-10 15:32:44 -07:00
Usage with a user resource:
2020-10-06 20:34:16 -04:00
```terraform
2020-09-17 15:34:00 -07:00
resource "boundary_scope" "org" {
2020-10-13 23:12:03 -04:00
name = "organization_one"
description = "My first scope!"
scope_id = "global"
auto_create_admin_role = true
auto_create_default_role = true
2020-09-17 15:34:00 -07:00
}
2020-08-11 16:12:26 -07:00
resource "boundary_user" "foo" {
name = "User 1"
2020-09-17 15:34:00 -07:00
scope_id = boundary_scope.org.id
2020-07-10 15:32:44 -07:00
}
2020-08-11 16:12:26 -07:00
resource "boundary_user" "bar" {
name = "User 2"
2020-09-17 15:34:00 -07:00
scope_id = boundary_scope.org.id
2020-07-10 15:32:44 -07:00
}
2020-08-11 16:12:26 -07:00
resource "boundary_role" "example" {
2021-09-02 00:36:33 +03:00
name = "My role"
description = "My first role!"
principal_ids = [boundary_user.foo.id, boundary_user.bar.id]
scope_id = boundary_scope.org.id
2020-07-12 15:00:16 -07:00
}
```
Usage with user and grants resource:
2020-10-06 20:34:16 -04:00
```terraform
2020-09-17 15:34:00 -07:00
resource "boundary_scope" "org" {
2020-10-13 23:12:03 -04:00
name = "organization_one"
description = "My first scope!"
scope_id = "global"
auto_create_admin_role = true
auto_create_default_role = true
2020-09-17 15:34:00 -07:00
}
2020-08-11 16:12:26 -07:00
resource "boundary_user" "readonly" {
name = "readonly"
2020-07-12 15:00:16 -07:00
description = "A readonly user"
2020-09-17 15:34:00 -07:00
scope_id = boundary_scope.org.id
2020-07-12 15:00:16 -07:00
}
2020-08-11 16:12:26 -07:00
resource "boundary_role" "readonly" {
2021-09-02 00:36:33 +03:00
name = "readonly"
description = "A readonly role"
principal_ids = [boundary_user.readonly.id]
2024-02-01 08:36:14 -08:00
grant_strings = ["ids=*;type=*;actions=read"]
2021-09-02 00:36:33 +03:00
scope_id = boundary_scope.org.id
2020-07-10 15:32:44 -07:00
}
```
Usage for a project-specific role:
2020-10-06 20:34:16 -04:00
```terraform
2020-09-17 15:34:00 -07:00
resource "boundary_scope" "org" {
2020-10-13 23:12:03 -04:00
name = "organization_one"
description = "My first scope!"
scope_id = "global"
auto_create_admin_role = true
auto_create_default_role = true
2020-09-17 15:34:00 -07:00
}
2020-09-17 15:34:00 -07:00
resource "boundary_scope" "project" {
2021-01-14 14:07:36 -08:00
name = "project_one"
description = "My first scope!"
scope_id = boundary_scope.org.id
auto_create_admin_role = true
}
resource "boundary_user" "readonly" {
name = "readonly"
description = "A readonly user"
2020-09-17 15:34:00 -07:00
scope_id = boundary_scope.org.id
}
resource "boundary_role" "readonly" {
2021-09-02 00:36:33 +03:00
name = "readonly"
description = "A readonly role"
principal_ids = [boundary_user.readonly.id]
2024-02-01 08:36:14 -08:00
grant_strings = ["ids=*;type=*;actions=read"]
2021-09-02 00:36:33 +03:00
scope_id = boundary_scope.project.id
}
```
2021-01-14 14:07:36 -08:00
<!-- schema generated by tfplugindocs -->
2020-10-06 20:34:16 -04:00
## Schema
### Required
2022-05-13 18:10:43 -07:00
- `scope_id` (String) The scope ID in which the resource is created. Defaults to the provider's `default_scope` if unset.
2020-10-06 20:34:16 -04:00
### Optional
2020-07-02 14:23:56 -07:00
2022-05-13 18:10:43 -07:00
- `description` (String) The role description.
- `grant_scope_id` (String)
- `grant_strings` (Set of String) A list of stringified grants for the role.
- `name` (String) The role name. Defaults to the resource name.
- `principal_ids` (Set of String) A list of principal (user or group) IDs to add as principals on the role.
2020-10-07 12:04:11 -04:00
2021-05-05 10:02:53 -07:00
### Read-Only
2022-05-13 18:10:43 -07:00
- `id` (String) The ID of the role.
2020-10-07 12:04:11 -04:00
## Import
Import is supported using the following syntax:
```shell
terraform import boundary_role.foo <my-id>
2020-10-13 23:12:03 -04:00
```