From 9e644689e0878b35cd6e60bf69886b69dde49f39 Mon Sep 17 00:00:00 2001 From: Ryan Ahearn Date: Thu, 26 Dec 2024 13:19:25 -0500 Subject: [PATCH] Set space roles with user GUID instead of name --- cg_space/main.tf | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cg_space/main.tf b/cg_space/main.tf index ae5bee3..0cf5cd3 100644 --- a/cg_space/main.tf +++ b/cg_space/main.tf @@ -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" }