Skip to content
GantryCD Provider

gantrycd_role_assignment (Resource)

A direct grant of a role to a user. There is no update endpoint: changing user_id or role_key destroys and recreates the assignment.

Example Usage

resource "gantrycd_role" "payments_deployer" {
  key  = "payments-deployer"
  name = "payments-deployer"

  permission {
    resource_type = "stack"
    action        = "deploy"
    authz_label   = "team-payments"
  }
}

# Grants take role keys directly: a custom role's explicit key, or a built-in
# system role key such as "stack-admin".
resource "gantrycd_role_assignment" "alice_deployer" {
  user_id  = "usr_01HXXXXXXXXXXXXXXXXXXXXXXX"
  role_key = gantrycd_role.payments_deployer.key
}

resource "gantrycd_role_assignment" "alice_admin" {
  user_id  = "usr_01HXXXXXXXXXXXXXXXXXXXXXXX"
  role_key = "stack-admin"
}

Schema

Required

  • role_key (String) Key of the role granted — either a custom role’s gantrycd_role.key or a system role’s key. Requires replacement.
  • user_id (String) User the role is granted to. Requires replacement.

Read-Only

  • id (String) Server-assigned assignment UUID. Used as the Terraform import id.
  • identity_realm (String) Identity realm inherited from the configured provider.

Import

Import is supported using the following syntax:

The terraform import command can be used, for example:

# Import by assignment id. The API returns a role id, not a key, so set
# role_key in configuration to match before the next apply.
terraform import gantrycd_role_assignment.alice_deployer ra_01HXXXXXXXXXXXXXXXXXXXXXXX