I have following config:
resource "aws_vpc" "main" {
cidr_block = "10.0.0.0/16"
}
resource "aws_subnet" "main" {
vpc_id = "${aws_vpc.main.id}"
cidr_block = "10.0.1.0/24"
tags {
Name = "Main"
}
}
resource "aws_internet_gateway" "gw" {
vpc_id = "${aws_vpc.main.id}"
tags {
Name = "main"
}
}
resource "aws_route_table" "r" {
vpc_id = "${aws_vpc.main.id}"
route {
cidr_block = "0.0.0.0/0"
gateway_id = "${aws_internet_gateway.gw.id}"
}
tags {
Name = "main"
}
}
When its run, there will be two route tables created for this VPC. One that is set as main:
10.0.0.0/16
local
Active
No
And the second that should be set as main:
10.0.0.0/16
local
Active
No
0.0.0.0/0
igw-d65299b2
Active
No
Hello – sorry for the year long silence here. Using a tag of Name and value main does not make the created aws_route_table the main route table. The main aws route table is created for you in the VPC, and cannot be created by Terraform. It can however be managed by Terraform with the aws_default_route_table:
its working with aws_default_route_table but not stable. i using in different region. one success. one failed. the error is route_table not found..
Hi @iilness2 !
I'm sorry you've run into this problem. You're not likely to get a response by comment on a closed ticket. If you have a new problem, I recommend opening a new issue in the aws provider repository.
I'm going to lock this issue because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.