From f554c77c2f823c6002777a63efe0412714dcffea Mon Sep 17 00:00:00 2001 From: Amit Phulera Date: Fri, 10 Nov 2023 14:23:54 +0530 Subject: [PATCH] add defaults for route table --- .../terraform/modules/network/main.tf | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/commcare_cloud/terraform/modules/network/main.tf b/src/commcare_cloud/terraform/modules/network/main.tf index da01004d50..56b992d1c5 100644 --- a/src/commcare_cloud/terraform/modules/network/main.tf +++ b/src/commcare_cloud/terraform/modules/network/main.tf @@ -98,7 +98,16 @@ resource "aws_route_table" "private" { vpc_id = aws_vpc.main.id dynamic "route" { - for_each = var.external_routes + for_each = concat( + tolist([ + tomap({ + cidr_block = "0.0.0.0/0", + nat_gateway_id = aws_nat_gateway.main.id, + }), + ]), + var.external_routes, + ) + content { # TF-UPGRADE-TODO: The automatic upgrade tool can't predict # which keys might be set in maps assigned here, so it has @@ -129,7 +138,15 @@ resource "aws_route_table" "public" { vpc_id = aws_vpc.main.id dynamic "route" { - for_each = var.external_routes + for_each = concat( + tolist([ + tomap({ + cidr_block = "0.0.0.0/0", + "gateway_id" = aws_internet_gateway.main.id, + }), + ]), + var.external_routes, + ) content { # TF-UPGRADE-TODO: The automatic upgrade tool can't predict # which keys might be set in maps assigned here, so it has