Skip to content

Instantly share code, notes, and snippets.

@mlabouardy
Created October 27, 2017 19:01
Show Gist options
  • Save mlabouardy/2c44b9221b5a0f4891f327e3ccbba253 to your computer and use it in GitHub Desktop.
Save mlabouardy/2c44b9221b5a0f4891f327e3ccbba253 to your computer and use it in GitHub Desktop.
Define Public Route table to route internet traffic to IGW
# Define the route table
resource "aws_route_table" "web-public-rt" {
vpc_id = "${aws_vpc.default.id}"
route {
cidr_block = "0.0.0.0/0"
gateway_id = "${aws_internet_gateway.gw.id}"
}
tags {
Name = "Public Subnet RT"
}
}
# Assign the route table to the public Subnet
resource "aws_route_table_association" "web-public-rt" {
subnet_id = "${aws_subnet.public-subnet.id}"
route_table_id = "${aws_route_table.web-public-rt.id}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment