Skip to content

Commit ce0a6bb

Browse files
small fixes for QAS for mission 4441 (#292)
* small fixes for QAS for mission 4441 * Update main.tf * Update main.tf Removing not needed ${} for the users --------- Co-authored-by: Rui Nogueira <[email protected]>
1 parent 27944af commit ce0a6bb

File tree

2 files changed

+12
-3
lines changed
  • released/discovery_center/mission_4441/minimal_setup_enterprise

2 files changed

+12
-3
lines changed

released/discovery_center/mission_4441/minimal_setup_enterprise/step1/main.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ resource "btp_subaccount_entitlement" "cloudfoundry" {
4848
}
4949

5050
resource "btp_subaccount_environment_instance" "cloudfoundry" {
51+
depends_on = [btp_subaccount_entitlement.build_code]
5152
subaccount_id = btp_subaccount.dc_mission.id
5253
name = "cf-${random_uuid.uuid.result}"
5354
environment_type = "cloudfoundry"
@@ -204,7 +205,7 @@ resource "local_file" "output_vars_step1" {
204205
cf_org_id = "${jsondecode(btp_subaccount_environment_instance.cloudfoundry.labels)["Org ID"]}"
205206
cf_org_name = "${jsondecode(btp_subaccount_environment_instance.cloudfoundry.labels)["Org Name"]}"
206207
207-
origin = "${var.origin}"
208+
origin_key = "${var.origin}"
208209
209210
cf_space_name = "${var.cf_space_name}"
210211

released/discovery_center/mission_4441/minimal_setup_enterprise/step2/main.tf

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,25 @@ resource "cloudfoundry_space" "dev" {
1616
# ------------------------------------------------------------------------------------------------------
1717
# Assign CF Org roles to the admin users
1818
# ------------------------------------------------------------------------------------------------------
19+
# Remove current user from org roles
20+
data "btp_whoami" "me" {}
21+
22+
locals {
23+
cf_org_admins = setsubtract(toset(var.cf_org_admins), [data.btp_whoami.me.email])
24+
}
25+
1926
# Define Org User role
2027
resource "cloudfoundry_org_role" "organization_user" {
21-
for_each = toset("${var.cf_org_admins}")
28+
for_each = toset(local.cf_org_admins)
2229
username = each.value
2330
type = "organization_user"
2431
org = var.cf_org_id
2532
origin = var.origin_key
2633
}
34+
2735
# Define Org Manager role
2836
resource "cloudfoundry_org_role" "organization_manager" {
29-
for_each = toset("${var.cf_org_admins}")
37+
for_each = toset(local.cf_org_admins)
3038
username = each.value
3139
type = "organization_manager"
3240
org = var.cf_org_id

0 commit comments

Comments
 (0)