From 86a01220424c85ec611160abbcd09bd44a1e5f05 Mon Sep 17 00:00:00 2001 From: shockrah Date: Fri, 26 Nov 2021 22:03:36 -0800 Subject: [PATCH] + Demeter EIP, and NAT Gateway for private instances * Updating naming scheme in gateway.tf & route-table.tf Should be more clear what each block is meant for --- infra/eip.tf | 7 +++++++ infra/gateway.tf | 11 ++++++++++- infra/route-table.tf | 3 ++- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/infra/eip.tf b/infra/eip.tf index 5b4d452..636c9eb 100644 --- a/infra/eip.tf +++ b/infra/eip.tf @@ -15,3 +15,10 @@ resource "aws_eip" "gamma_eip" { } } +resource "aws_eip" "demeter_eip" { + vpc = true + tags = { + Name = "NAT Gateway EIP" + } +} + diff --git a/infra/gateway.tf b/infra/gateway.tf index e4418d5..c80338c 100644 --- a/infra/gateway.tf +++ b/infra/gateway.tf @@ -1,7 +1,16 @@ -resource "aws_internet_gateway" "athens_gateway" { +resource "aws_internet_gateway" "athens_internet_gateway" { vpc_id = aws_vpc.athens_vpc.id tags = { Name = "Athens Common Internet Gateway" } } + +resource "aws_nat_gateway" "athens_nat_gateway" { + allocation_id = aws_eip.demeter_eip.id + subnet_id = aws_subnet.crete_subnet.id + + tags = { + Name = "Demeter - Crete' NAT" + } +} diff --git a/infra/route-table.tf b/infra/route-table.tf index d7ea362..de2a07d 100644 --- a/infra/route-table.tf +++ b/infra/route-table.tf @@ -3,7 +3,7 @@ resource "aws_route_table" "crete_route_table" { route { # ???? cidr_block = "0.0.0.0/0" - gateway_id = aws_internet_gateway.athens_gateway.id + gateway_id = aws_internet_gateway.athens_internet_gateway.id } tags = { Name = "Crete Route Table" @@ -14,3 +14,4 @@ resource "aws_route_table_association" "crete_gateway_association" { subnet_id = aws_subnet.crete_subnet.id route_table_id = aws_route_table.crete_route_table.id } +