terraform-provider-stackgen

sg_role (Resource)

Manages a custom role with configurable permission scopes.

Use the sg_scopes data source to discover available scopes. Assign roles to users via sg_project_member. Import using the role UUID.

Example Usage

# Custom role with explicit permission scopes — use data.sg_scopes to discover valid scope strings.
resource "sg_role" "example" {
  name        = "Deployer"
  description = "Can deploy and manage infrastructure within projects."
  scopes = [
    "listOrg",
    "getResource",
    "updateResource",
  ]
}

Import

Import an existing sg_role using its role ID:

terraform import sg_role.example '123e4567-e89b-12d3-a456-426614174000'

Schema

Required

Read-Only