This resource allows you to create custom Roles for assigning to Users.
See https://docs.pactflow.io/docs/permissions/predefined-roles for documentation on managing users and roles within Pactflow.
-> This feature is only available for the Pactflow platform.
The following example shows the basic usage of the resource. We are creating a custom role that allows the user permissions to manage people and teams:
resource "pact_role" "special_role" {
name = "CustomUserManagementRole"
scopes = [
"user:manage:*",
"team:manage:*",
"user:invite",
"system_account:manage:*",
"system_account:read:*",
"user:read:*",
"team:read:*",
]
}
The following arguments are supported:
role
- (Required, string) The string name of a role to assign. Currently the only option isadministrator
.scopes
- (Required, list of strings) The scopes to apply to the role (see below for the available scopes)
See https://docs.pactflow.io/docs/permissions/permissions for the definitive list of permissions. They will take the shape of
resource:permission:scope
e.g.
user:manage:*
team:manage:*
token:manage:own
read_token:manage:own
etc.
As per the docs, the ID used for importingis simply the name of the application.
You need to first obtain the existing role uuid, which you can find via the API/HAL browser.
- Create the shell for the application to be imported into, ensuring the scopes are what you intend it to be:
resource "pact_role" "special_role" {
name = "CustomUserManagementRole"
scopes = [
"user:manage:*",
"team:manage:*",
"user:invite",
"system_account:manage:*",
"system_account:read:*",
"user:read:*",
"team:read:*",
]
}
- Import the resource
terraform import pact_role.special_role <role uuid>
- Apply any new changes
teraform apply