Skip to content

Instantly share code, notes, and snippets.

@NYARAS
Created November 18, 2021 21:56
Show Gist options
  • Save NYARAS/8db8aed2d66d420115b24c796c084e45 to your computer and use it in GitHub Desktop.
Save NYARAS/8db8aed2d66d420115b24c796c084e45 to your computer and use it in GitHub Desktop.
resource "aws_route_table" "public" {
# The VPC ID.
vpc_id = aws_vpc.main.id
route {
# The CIDR block of the route
cidr_block = "0.0.0.0/0"
# Identifier of the VPC internet gateway or a virtual private gateway
gateway_id = aws_internet_gateway.main.id
}
# A map of tags to assign to the resource
tags = {
"Name" = "public"
}
}
resource "aws_route_table" "private1" {
# The VPC ID.
vpc_id = aws_vpc.main.id
route {
# The CIDR block of the route
cidr_block = "0.0.0.0/0"
# Identifier of the VPC NAT gateway.
gateway_id = aws_nat_gateway.gw1.id
}
# A map of tags to assign to the resource
tags = {
"Name" = "private1"
}
}
resource "aws_route_table" "private2" {
# The VPC ID.
vpc_id = aws_vpc.main.id
route {
# The CIDR block of the route
cidr_block = "0.0.0.0/0"
# Identifier of the VPC NAT gateway.
gateway_id = aws_nat_gateway.gw2.id
}
# A map of tags to assign to the resource
tags = {
"Name" = "private2"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment