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.
# 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 an existing sg_role using its role ID:
terraform import sg_role.example '123e4567-e89b-12d3-a456-426614174000'
description (String) Human-readable description of the role.name (String) Role name. Only alphabetic characters (A-Z a-z) allowed. Must be unique regardless of casing.,validnamescopes (Set of String) Permission scopes assigned to this role. Use the sg_scopes data source to discover available values.custom (Boolean) Whether this is a custom user-created role. Always true for Terraform-managed roles.id (String) Unique role identifier (UUID; server-assigned).