Skip to content

Commit

Permalink
chore: define nat gateway routes for private route tables outside of …
Browse files Browse the repository at this point in the history
…aws_route_table resources in samples and modules (aws-games#354)
  • Loading branch information
jorisdon authored Oct 10, 2024
1 parent fd7b39b commit 3daa21e
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 24 deletions.
13 changes: 7 additions & 6 deletions modules/jenkins/examples/complete/vpc.tf
Original file line number Diff line number Diff line change
Expand Up @@ -100,19 +100,20 @@ resource "aws_eip" "nat_gateway_eip" {
resource "aws_route_table" "private_rt" {
vpc_id = aws_vpc.jenkins_vpc.id

# route to the internet through NAT gateway
route {
cidr_block = "0.0.0.0/0"
nat_gateway_id = aws_nat_gateway.nat_gateway.id
}

tags = merge(local.tags,
{
Name = "jenkins-private-rt"
}
)
}

# route to the internet through NAT gateway
resource "aws_route" "private_rt_nat_gateway" {
route_table_id = aws_route_table.private_rt.id
destination_cidr_block = "0.0.0.0/0"
nat_gateway_id = aws_nat_gateway.nat_gateway.id
}

resource "aws_route_table_association" "private_rt_asso" {
count = length(aws_subnet.private_subnets)
route_table_id = aws_route_table.private_rt.id
Expand Down
13 changes: 7 additions & 6 deletions modules/perforce/examples/complete/vpc.tf
Original file line number Diff line number Diff line change
Expand Up @@ -100,19 +100,20 @@ resource "aws_eip" "nat_gateway_eip" {
resource "aws_route_table" "private_rt" {
vpc_id = aws_vpc.perforce_vpc.id

# route to the internet through NAT gateway
route {
cidr_block = "0.0.0.0/0"
nat_gateway_id = aws_nat_gateway.nat_gateway.id
}

tags = merge(local.tags,
{
Name = "perforce-private-rt"
}
)
}

# route to the internet through NAT gateway
resource "aws_route" "private_rt_nat_gateway" {
route_table_id = aws_route_table.private_rt.id
destination_cidr_block = "0.0.0.0/0"
nat_gateway_id = aws_nat_gateway.nat_gateway.id
}

resource "aws_route_table_association" "private_rt_asso" {
count = length(aws_subnet.private_subnets)
route_table_id = aws_route_table.private_rt.id
Expand Down
13 changes: 7 additions & 6 deletions modules/unreal/horde/examples/complete/vpc.tf
Original file line number Diff line number Diff line change
Expand Up @@ -92,19 +92,20 @@ resource "aws_eip" "nat_gateway_eip" {
resource "aws_route_table" "private_rt" {
vpc_id = aws_vpc.unreal_engine_horde_vpc.id

# route to the internet through NAT gateway
route {
cidr_block = "0.0.0.0/0"
nat_gateway_id = aws_nat_gateway.nat_gateway.id
}

tags = merge(local.tags,
{
Name = "unreal-horde-private-rt"
}
)
}

# route to the internet through NAT gateway
resource "aws_route" "private_rt_nat_gateway" {
route_table_id = aws_route_table.private_rt.id
destination_cidr_block = "0.0.0.0/0"
nat_gateway_id = aws_nat_gateway.nat_gateway.id
}

resource "aws_route_table_association" "private_rt_asso" {
count = length(aws_subnet.private_subnets)
route_table_id = aws_route_table.private_rt.id
Expand Down
13 changes: 7 additions & 6 deletions samples/simple-build-pipeline/vpc.tf
Original file line number Diff line number Diff line change
Expand Up @@ -100,19 +100,20 @@ resource "aws_eip" "nat_gateway_eip" {
resource "aws_route_table" "private_rt" {
vpc_id = aws_vpc.build_pipeline_vpc.id

# route to the internet through NAT gateway
route {
cidr_block = "0.0.0.0/0"
nat_gateway_id = aws_nat_gateway.nat_gateway.id
}

tags = merge(local.tags,
{
Name = "build-pipeline-private-rt"
}
)
}

# route to the internet through NAT gateway
resource "aws_route" "private_rt_nat_gateway" {
route_table_id = aws_route_table.private_rt.id
destination_cidr_block = "0.0.0.0/0"
nat_gateway_id = aws_nat_gateway.nat_gateway.id
}

resource "aws_route_table_association" "private_rt_asso" {
count = length(aws_subnet.private_subnets)
route_table_id = aws_route_table.private_rt.id
Expand Down

0 comments on commit 3daa21e

Please sign in to comment.