From b4beb20027e192711a7f3715a24cb98bb92e4a93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arturo=20Filast=C3=B2?= Date: Fri, 19 Apr 2024 13:42:31 +0200 Subject: [PATCH] Fix NAT configuration and properly set Name tags --- tf/modules/network/main.tf | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/tf/modules/network/main.tf b/tf/modules/network/main.tf index d8f04100..f69563be 100644 --- a/tf/modules/network/main.tf +++ b/tf/modules/network/main.tf @@ -52,28 +52,38 @@ resource "aws_subnet" "private" { } } -resource "aws_eip" "main" { +resource "aws_eip" "nat" { count = var.az_count domain = "vpc" depends_on = [aws_internet_gateway.gw] } resource "aws_nat_gateway" "nat_gw" { - count = var.az_count - subnet_id = element(aws_subnet.private[*].id, count.index) - allocation_id = element(aws_eip.main[*].id, count.index) + count = var.az_count + + allocation_id = element(aws_eip.nat[*].id, count.index) + subnet_id = element(aws_subnet.public[*].id, count.index) depends_on = [aws_internet_gateway.gw] + + tags = { + Name = "ooni-nat-gw" + } } resource "aws_internet_gateway" "gw" { vpc_id = aws_vpc.main.id + tags = { + Name = "ooni-internet-gw" + } } resource "aws_egress_only_internet_gateway" "egress_gw" { vpc_id = aws_vpc.main.id - tags = var.tags + tags = { + Name = "ooni-egressonly-gw" + } } moved { @@ -120,7 +130,7 @@ resource "aws_route_table" "private" { } tags = { - Name = "ooni-public-route-table-${count.index}" + Name = "ooni-private-route-table-${count.index}" } }