feat: nat-gateways

This commit is contained in:
david committed 2024-04-27 18:25:39 +02:00
1 parent b7b1653cc6
commit e19d7fc053
11 files changed
+88 -53

No files matched your search

+3 -27
View File
@@ -11,31 +11,7 @@ resource "aws_subnet" "self" {
}
}
resource "aws_internet_gateway" "self" {
count = local.public_enabled ? 1 : 0
vpc_id = aws_vpc.self.id
tags = {
Name = join("-", compact([var.prefix, "gw"]))
}
}
resource "aws_route_table" "public" {
count = local.public_enabled ? 1 : 0
vpc_id = aws_vpc.self.id
route {
cidr_block = "0.0.0.0/0"
gateway_id = aws_internet_gateway.self[0].id
}
tags = {
Name = join("-", compact([var.prefix, "public"]))
}
}
resource "aws_route_table_association" "public" {
for_each = toset([for k, v in local.subnets_attributes : k if v.public])
route_table_id = aws_route_table.public[0].id
subnet_id = aws_subnet.self[each.value].id
resource "aws_eip" "self" {
for_each = local.nat_gateways
domain = "vpc"
}