Skip to content

Commit 2f74af0

Browse files
authored
fix: Acls created for network cidr are open to Any IP (#569)
* fix: network cidr inbound Any IP * test: remove ignoreupdates
1 parent 249a475 commit 2f74af0

File tree

3 files changed

+20
-15
lines changed

3 files changed

+20
-15
lines changed

module-metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@
600600
},
601601
"pos": {
602602
"filename": "network_acls.tf",
603-
"line": 152
603+
"line": 162
604604
}
605605
},
606606
"ibm_is_public_gateway.gateway": {

network_acls.tf

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,28 @@ locals {
4848
]
4949

5050
ibm_cloud_internal_rules = flatten([
51-
for rules in local.internal_rules : [
52-
for index, cidrs in var.network_cidrs != null ? var.network_cidrs : ["0.0.0.0/0"] :
53-
merge(rules, {
54-
name = "${rules.name}-${index}"
55-
source = cidrs
56-
})
57-
]
51+
for index, cidrs in var.network_cidrs != null ? var.network_cidrs : ["0.0.0.0/0"] :
52+
flatten([
53+
[
54+
for rule in local.internal_rules :
55+
merge(rule, {
56+
name = "${rule.name}-${index}"
57+
source = cidrs
58+
}) if rule.direction == "outbound"
59+
],
60+
[
61+
for rule in local.internal_rules :
62+
merge(rule, {
63+
name = "${rule.name}-${index}"
64+
destination = cidrs
65+
}) if rule.direction == "inbound"
66+
]
67+
])
5868
])
5969

6070
vpc_inbound_rule = flatten([
61-
for address in data.ibm_is_vpc_address_prefixes.get_address_prefixes.address_prefixes : [
62-
for index, cidrs in var.network_cidrs != null ? var.network_cidrs : ["0.0.0.0/0"] :
71+
for index, cidrs in var.network_cidrs != null ? var.network_cidrs : ["0.0.0.0/0"] : [
72+
for address in data.ibm_is_vpc_address_prefixes.get_address_prefixes.address_prefixes :
6373
{
6474
name = "ibmflow-allow-vpc-connectivity-inbound-${substr(address.id, -4, -1)}-${index}" # Providing unique rule names
6575
action = "allow"

tests/pr_test.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,6 @@ func setupOptions(t *testing.T, prefix string, terraformDir string) *testhelper.
3636
TerraformDir: terraformDir,
3737
Prefix: prefix,
3838
ResourceGroup: resourceGroup,
39-
IgnoreUpdates: testhelper.Exemptions{ // Ignore for consistency check
40-
List: []string{
41-
"module.slz_vpc.ibm_is_network_acl.network_acl[\"vpc-acl\"]",
42-
},
43-
},
4439
TerraformVars: map[string]interface{}{
4540
"access_tags": permanentResources["accessTags"],
4641
},

0 commit comments

Comments
 (0)