-
Notifications
You must be signed in to change notification settings - Fork 9.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failure while trying to add more routes to a route table. #7038
Comments
I just ran into a similar issue it looks like. My plan shows that I have to routes left to create.
Our apply error output shows that we cannot create these routes because they already exist.
I scrubbed out statefile and left the relevant parts: I left the "peer_foo_to_bop" state in the statefile as an example of the expected behavior. |
@jniesen that error indicates routes already exist on that Route Table for those cidr blocks, can you view them in the AWS web console? They would need to be removed there first, then applied via Terraform if you want Terraform to track them. If you hit something where you attempted to add them, it failed for some reason(s) , and then it failed again because they were already there, that would be different. |
@feanil hrm, this issue is odd... do you have a configuration that reproduces this? Looking at the diff contents:
There's practically nothing in the |
@catsby That's the weird thing. They didn't exist until I applied the Terraform a first time. Terraform created them, but didn't record them in the statefile. I have a module called vpc_peers that creates a vpc_peering_connection, and entries in a route_table that point to the peer connection. This is the main.tf from the module. It's hosted on a GHE instance so I can't provide a link. resource "aws_vpc_peering_connection" "peer" {
peer_owner_id = "${var.peer_aws_account}"
peer_vpc_id = "${var.peer_vpc_id}"
vpc_id = "${var.vpc_id}"
}
resource "aws_route" "private_peer_routes" {
count = "${length(compact(split(",", var.peer_private_routes)))}"
route_table_id = "${var.private_route_table_id}"
destination_cidr_block = "${element(split(",", var.peer_private_routes), count.index)}"
vpc_peering_connection_id = "${aws_vpc_peering_connection.peer.id}"
}
resource "aws_route" "public_peer_routes" {
count = "${length(compact(split(",", var.peer_public_routes)))}"
route_table_id = "${var.public_route_table_id}"
destination_cidr_block = "${element(split(",", var.peer_public_routes), count.index)}"
vpc_peering_connection_id = "${aws_vpc_peering_connection.peer.id}"
} If you look at the statefile, you can see one of these modules being applied and recorded in the statefile correctly. Then you can see another one of these modules being applied, but not recorded in the statefile correctly. I say it was applied be the the route table does show a record of the route being recorded. |
Are you by chance using any in-line routes declared in an |
@catsby no. I saw in the documentation that it recommended against using inline and aws_route resources at the same time. Also, since the VPC and route tables are being created with the use of the tf_aws_vpc community module, I didn't have a choice but to use aws_route resources. All of these things are being created by the community module. Sorry all of these. |
I'm having a similar issue with 0.6.16 For the first apply, I had forgotten to accept the peering request, so that may have caused the first failure, which was:
I accepted the peering, then tried again, but got:
I checked the aws console, the routes did end up in the route table, so I removed them again. Applyed again and saw the first failure again (and routes were back in aws console)
|
Not sure if it matters, but I'm passing the route-table IDs down into a module, which then adds the peering routes to those tables |
I am having this issue as well which is intermittent. I have VPC peering and several aws_route blocks adding routes to the main route table. Like @wr0ngway, I am passing the ID of an existing route-table into my terraform project. I verified via the AWS console that terraform creates the routes in the existing table but errors with:
If I run a terraform apply a second time, it errors with the following due to the resource already being created:
|
Yes, the intermittent issue is most likely due to the issue that I fixed in the open PR #6912 |
Same problem here with route tables and peering connections. Unlike other Terraform bugs that appear intermittently, once this one appears, re-running |
Hello! This should be fixed in later versions of Terraform (0.7.11 at time of writing). Its hard to know 100% for a couple reasons:
Please try again! If the issue persists please just open a new issue. Thanks! |
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. |
Hi there,
Thank you for opening an issue. Please note that we try to keep the Terraform issue tracker reserved for bug reports and feature requests. For general usage questions, please see: https://www.terraform.io/community.html.
Terraform Version
Terraform v0.6.16
Affected Resource(s)
Please list the resources as a list, for example:
If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.
Terraform Configuration Files
Debug Output
Panic Output
If Terraform produced a panic, please provide a link to a GitHub Gist containing the output of the
crash.log
.Expected Behavior
New routes created.
Actual Behavior
All routes got created but one route was created but not added to the state file.
The text was updated successfully, but these errors were encountered: