Skip to content

Commit

Permalink
Set space roles with user GUID instead of name
Browse files Browse the repository at this point in the history
  • Loading branch information
rahearn committed Dec 26, 2024
1 parent 5a5a603 commit 9e64468
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cg_space/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,20 @@ locals {
developer_names = setunion(var.developers, var.deployers)
}

data "cloudfoundry_user" "users" {
for_each = setunion(local.manager_names, local.developer_names)
name = each.key
}
resource "cloudfoundry_space_role" "managers" {
for_each = local.manager_names
username = each.key
user = data.cloudfoundry_user.users[each.key].users.0.id
space = cloudfoundry_space.space.id
type = "space_manager"
}

resource "cloudfoundry_space_role" "developers" {
for_each = local.developer_names
username = each.key
user = data.cloudfoundry_user.users[each.key].users.0.id
space = cloudfoundry_space.space.id
type = "space_developer"
}

0 comments on commit 9e64468

Please sign in to comment.