File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -160,7 +160,11 @@ locals {
160160}
161161
162162resource "ibm_is_network_acl" "network_acl" {
163- for_each = var. create_subnets ? local. acl_object : {}
163+ # due to a bug in terraform ternary conditional and nested map objects, use a for loop with if condition to only apply
164+ # ACLs if subnets are being created (not for existing subnets scenario)
165+ # The old version of this that had the bug was:
166+ # for_each = var.create_subnets ? local.acl_object : {}
167+ for_each = { for acl_key , acl_value in local . acl_object : acl_key => acl_value if var . create_subnets }
164168 name = var. prefix != null ? " ${ var . prefix } -${ each . key } " : each. key # already has name of vpc in each.key
165169 vpc = local. vpc_id
166170 resource_group = var. resource_group_id
You can’t perform that action at this time.
0 commit comments