From 8b1d576bfb9b0e867ce312ff23c687534499b575 Mon Sep 17 00:00:00 2001 From: shockrah Date: Wed, 24 Nov 2021 21:14:23 -0800 Subject: [PATCH] !+ Creating infra points for internet access on Crete subnet With this patch members of the Crete subnet will be able to properly access the outside world which is required for these services to function as intended. --- infra/eip.tf | 9 +++++++++ infra/gateway.tf | 7 +++++++ infra/route-table.tf | 15 +++++++++++++++ 3 files changed, 31 insertions(+) create mode 100644 infra/eip.tf create mode 100644 infra/gateway.tf create mode 100644 infra/route-table.tf diff --git a/infra/eip.tf b/infra/eip.tf new file mode 100644 index 0000000..433c3dd --- /dev/null +++ b/infra/eip.tf @@ -0,0 +1,9 @@ +# Beta will basically always be the static web server +# hence why we explicitly setup an EIP for it alone like this +resource "aws_eip" "beta_eip" { + instance = aws_instance.beta.id + vpc = true + tags = { + Name = "Beta Elastic IP" + } +} diff --git a/infra/gateway.tf b/infra/gateway.tf new file mode 100644 index 0000000..e4418d5 --- /dev/null +++ b/infra/gateway.tf @@ -0,0 +1,7 @@ +resource "aws_internet_gateway" "athens_gateway" { + vpc_id = aws_vpc.athens_vpc.id + + tags = { + Name = "Athens Common Internet Gateway" + } +} diff --git a/infra/route-table.tf b/infra/route-table.tf new file mode 100644 index 0000000..9765d0f --- /dev/null +++ b/infra/route-table.tf @@ -0,0 +1,15 @@ +resource "aws_route_table" "crete_route_table" { + vpc_id = aws_vpc.athens_vpc.id + route { + cidr_block = var.crete_cidr + gateway_id = aws_internet_gateway.athens_gateway.id + } + tags = { + Name = "Crete Route Table" + } +} + +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 +}