Skip to content

Commit

Permalink
fix: Correct the logic to add -1 depth account-group as immediate par…
Browse files Browse the repository at this point in the history
…ent instead of making same depth account group as parent (#162)

Co-authored-by: namrata <[email protected]>
  • Loading branch information
namratabhadauriya and namrata authored Apr 17, 2024
1 parent 1d7cef2 commit 774d2e4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions submodules/dynamic_values/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ locals {
depth_1_accounts = {
for value in local.nested_accounts :
value.key_name => value
if contains(keys(local.depth_1_account_groups), value.parent_key_name)
if contains(keys(local.depth_0_account_groups), value.parent_key_name)
}

depth_2_accounts = {
for value in local.nested_accounts :
value.key_name => value
if contains(keys(local.depth_2_account_groups), value.parent_key_name)
if contains(keys(local.depth_1_account_groups), value.parent_key_name)
}

enterprise_hierarchy_depth_0 = {
Expand Down
2 changes: 1 addition & 1 deletion submodules/enterprise_hierarchy/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ resource "ibm_enterprise_account_group" "enterprise_account_group" {

resource "ibm_enterprise_account" "enterprise_account" {
for_each = var.enterprise_hierarchy.accounts
parent = each.value.parent_key_name != null ? resource.ibm_enterprise_account_group.enterprise_account_group[each.value.parent_key_name].crn : var.enterprise_crn
parent = each.value.parent_key_name != null ? var.parent_account_groups[each.value.parent_key_name].crn : var.enterprise_crn
name = each.value.name
owner_iam_id = each.value.owner_iam_id == null ? var.enterprise_primary_contact_iam_id : each.value.owner_iam_id
}

0 comments on commit 774d2e4

Please sign in to comment.