From 2f3b480c39fc7f34e59185e81f7d50c94153839b Mon Sep 17 00:00:00 2001 From: Andrew Trice Date: Wed, 22 Jun 2022 15:54:23 -0400 Subject: [PATCH] trim acl rule names to max 63 chars to prevent failures (#65) * trim acl rule names to max 63 chars to prevent failures Signed-off-by: Andrew Trice --- main.tf | 2 +- test/stages/stage2-subnets.tf | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/main.tf b/main.tf index 0ff8b96..a0bc1e2 100644 --- a/main.tf +++ b/main.tf @@ -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"] diff --git a/test/stages/stage2-subnets.tf b/test/stages/stage2-subnets.tf index dd51650..c75c3d5 100644 --- a/test/stages/stage2-subnets.tf +++ b/test/stages/stage2-subnets.tf @@ -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" @@ -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"