Created
October 27, 2017 19:01
-
-
Save mlabouardy/2c44b9221b5a0f4891f327e3ccbba253 to your computer and use it in GitHub Desktop.
Define Public Route table to route internet traffic to IGW
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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