Skip to content
GantryCD Provider

gantrycd_service_account_role_assignment (Resource)

Grants a role to a standalone (org-level) service account. There is no update endpoint: changing service_account_id or role_key requires replacement.

Example Usage

resource "gantrycd_service_account" "ci" {
  name = "ci-bot"
}

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

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

resource "gantrycd_service_account_role_assignment" "ci_deployer" {
  service_account_id = gantrycd_service_account.ci.id
  role_key           = gantrycd_role.payments_deployer.key
}

Schema

Required

  • role_key (String) Key of the role to grant. No update endpoint exists, so changing this requires replacement.
  • service_account_id (String) Service account that receives the role.

Read-Only

  • id (String) Server-assigned role assignment UUID. Used together with service_account_id as the Terraform import id (<service_account_id>/<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 with a composite id: <service_account_id>/<assignment_id>.
terraform import gantrycd_service_account_role_assignment.ci_deployer sa_01HXXXXXXXXXXXXXXXXXXXXXXX/ra_01HXXXXXXXXXXXXXXXXXXXXXXX