gantrycd_stack_service_account_role_assignment (Resource)
Grants a role to a stack’s implicit default service account — the principal the stack’s deployments and lifecycle hooks authenticate as. There is no update endpoint: changing stack_id or role_key requires replacement.
Example Usage
resource "gantrycd_stack" "payments" {
name = "payments-production"
repository_url = "https://github.com/example/infrastructure"
working_directory = "/payments"
branch = "main"
opentofu_version = "1.11.0"
}
# Every stack has an implicit default service account that its deployments and
# lifecycle hooks authenticate as. Grant it a read-only role so a hook can call
# the GantryCD API safely.
resource "gantrycd_stack_service_account_role_assignment" "payments_reader" {
stack_id = gantrycd_stack.payments.id
role_key = "stack-reader"
}
Schema
Required
role_key(String) Key of the role to grant. No update endpoint exists, so changing this requires replacement.stack_id(String) Stack whose default service account receives the role.
Read-Only
id(String) Server-assigned role assignment UUID. Used together with stack_id as the Terraform import id (<stack_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: <stack_id>/<assignment_id>.
terraform import gantrycd_stack_service_account_role_assignment.payments_reader stk_01HXXXXXXXXXXXXXXXXXXXXXXX/ra_01HXXXXXXXXXXXXXXXXXXXXXXX