Manages a user’s membership and role assignment within a StackGen project.
Changing project_id or user_id forces a new resource. Import with: terraform import sg_project_member.example <project_id>/<user_id>
# Wire a user into a project with a role. Resolve role_id from sg_roles or a sg_role resource.
variable "project_id" {
type = string
description = "UUID of the project (from sg_project.*.id)."
}
variable "user_id" {
type = string
description = "UUID of the user (often from data.sg_me.id)."
}
variable "role_id" {
type = string
description = "UUID of the role to assign (built-in or sg_role.*.id)."
}
resource "sg_project_member" "example" {
project_id = var.project_id
user_id = var.user_id
role_id = var.role_id
}
Import an existing sg_project_member using its project ID/user ID:
terraform import sg_project_member.example 'project-uuid/user-uuid'
project_id (String) ID of the project (organization) to assign the user to. Changing forces replacement.role_id (String) UUID of the role to assign to the user within the project.user_id (String) UUID of the user to assign to the project. Changing forces replacement.id (String) Composite identifier in the format