Skip to content

Commit

Permalink
trim acl rule names to max 63 chars to prevent failures (#65)
Browse files Browse the repository at this point in the history
* trim acl rule names to max 63 chars to prevent failures

Signed-off-by: Andrew Trice <amtrice@us.ibm.com>
  • Loading branch information
Andrew Trice authored Jun 22, 2022
1 parent 5a0e985 commit 2f3b480
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ resource ibm_is_network_acl_rule acl_rule {

network_acl = var.provision ? ibm_is_network_acl.subnet_acl[0].id : ""

name = "${local.name_prefix}-${local.acl_rules[count.index]["name"]}"
name = substr("${local.name_prefix}-${local.acl_rules[count.index]["name"]}", 0, 63)
action = local.acl_rules[count.index]["action"]
direction = local.acl_rules[count.index]["direction"]
source = local.acl_rules[count.index]["source"]
Expand Down
4 changes: 2 additions & 2 deletions test/stages/stage2-subnets.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module "subnets" {
ipv4_cidr_blocks = jsondecode(var.ipv4_cidr_blocks)
ipv4_address_count = var.ipv4_address_count
acl_rules = [{
name="ingress-ssh"
name="ingress-ssh---this-is-a-really-long-name-to-test-for-proper-string-trimming"
action="allow"
direction="inbound"
source="0.0.0.0/0"
Expand All @@ -22,7 +22,7 @@ module "subnets" {
source_port_max=22
}
}, {
name="egress-ssh"
name="egress-ssh---this-is-a-really-long-name-to-test-for-proper-string-trimming"
action="allow"
direction="outbound"
destination="0.0.0.0/0"
Expand Down

0 comments on commit 2f3b480

Please sign in to comment.