Last active
July 14, 2017 15:12
-
-
Save trung/9b965f618b0de14dc7d83e41698b3a06 to your computer and use it in GitHub Desktop.
How to retrieve default route table id for a VPC
This file contains 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
variable "vpcId" { | |
default = "vpc-5f98eb36" | |
} | |
data "aws_route_table" "all" { | |
vpc_id = "${var.vpcId}" | |
filter { | |
name = "association.main" | |
values = ["true"] | |
} | |
} | |
output "defaultRouteTableId" { | |
value = "${data.aws_route_table.all.associations.0.route_table_id}" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment