diff --git a/cg_space/outputs.tf b/cg_space/outputs.tf index 1182b42..df86723 100644 --- a/cg_space/outputs.tf +++ b/cg_space/outputs.tf @@ -9,3 +9,11 @@ output "space_name" { output "space" { value = cloudfoundry_space.space } + +output "developer_role_ids" { + value = { for username in local.developer_names : username => cloudfoundry_space_role.developers[username].id } +} + +output "manager_role_ids" { + value = { for username in local.manager_names : username => cloudfoundry_space_role.managers[username].id } +} diff --git a/cg_space/tests/creation.tftest.hcl b/cg_space/tests/creation.tftest.hcl index ad4005f..bdd52a4 100644 --- a/cg_space/tests/creation.tftest.hcl +++ b/cg_space/tests/creation.tftest.hcl @@ -78,4 +78,19 @@ run "test_deployer_permissions" { condition = keys(cloudfoundry_space_role.developers) == ["paul.hirsch@gsa.gov", "ryan.ahearn@gsa.gov"] error_message = "Should set Space Developers to var.developers + var.deployers" } + + assert { + condition = output.developer_role_ids == { + "paul.hirsch@gsa.gov" = cloudfoundry_space_role.developers["paul.hirsch@gsa.gov"].id, + "ryan.ahearn@gsa.gov" = cloudfoundry_space_role.developers["ryan.ahearn@gsa.gov"].id + } + error_message = "Output includes the developer role ids" + } + + assert { + condition = output.manager_role_ids == { + "ryan.ahearn@gsa.gov" = cloudfoundry_space_role.managers["ryan.ahearn@gsa.gov"].id + } + error_message = "Output includes the manager role ids" + } }