I created a new VPC using this code
resource "aws_vpc" "main" {
cidr_block = "10.0.0.0/16"
enable_dns_hostnames = "true"
tags = {
Name = "MyVPC"
}
}
This also created a route table, and now I want to add a route to it. As per the documentation, I should do it like this:
resource "aws_route" "r" {
route_table_id = "rtb-4fbb3ac4"
destination_cidr_block = "10.0.1.0/22"
vpc_peering_connection_id = "pcx-45ff3dc1"
depends_on = [aws_route_table.testing]
}
But how can I retrieve the route_table_id of an existing route table that I haven’t created with terraform?