From 8701204c28a0ff984c5ade71400c6208c6953bfc Mon Sep 17 00:00:00 2001 From: Manuel Enrique Colotti Date: Thu, 25 Apr 2024 01:56:50 +0200 Subject: [PATCH] fix: Create private_ipv6_egress routes only when having at least one private subnet (#1062) Co-authored-by: Manuel Enrique Colotti --- main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.tf b/main.tf index d7429e59f..fa144b221 100644 --- a/main.tf +++ b/main.tf @@ -1021,7 +1021,7 @@ resource "aws_egress_only_internet_gateway" "this" { } resource "aws_route" "private_ipv6_egress" { - count = local.create_vpc && var.create_egress_only_igw && var.enable_ipv6 ? local.nat_gateway_count : 0 + count = local.create_vpc && var.create_egress_only_igw && var.enable_ipv6 && local.len_private_subnets > 0 ? local.nat_gateway_count : 0 route_table_id = element(aws_route_table.private[*].id, count.index) destination_ipv6_cidr_block = "::/0"