Skip to content

Latest commit

 

History

History
83 lines (59 loc) · 2 KB

File metadata and controls

83 lines (59 loc) · 2 KB

Role resource

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.

Compatibility

-> This feature is only available for the Pactflow platform.

Example Usage

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:*",
  ]
}

Argument Reference

The following arguments are supported:

  • role - (Required, string) The string name of a role to assign. Currently the only option is administrator.
  • scopes - (Required, list of strings) The scopes to apply to the role (see below for the available scopes)

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.

Importing

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.

  1. 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:*",
  ]
}
  1. Import the resource
terraform import pact_role.special_role <role uuid>
  1. Apply any new changes
teraform apply