-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
aws_route Error: more than 1 targe specified if you change the destination type #684
Comments
We're having the same issue as well even simply replacing from one ENI to another ENI in a route table. Terraform version is 0.9.9
|
We're having the same issue with Terraform v0.11.7 and provider.aws v1.10.0 |
This is still a bug in newer versions:
As a workaround you can rename your |
I am having the same issue. |
I've run into the same error recently. In my case Terraform tried creating a duplicate route instead of changing it. It helped to just |
I'm having multiple issues with updating existing routes. Is there any reason we shouldn't just unconditionally replace a route when it needs to change, rather than attempting an in-place update? The API call is fast, and delete/create works 100% of the time. Is there a downside? |
I am not a contributor, so am unfamiliar with the core codebase, but initially looking at it (terraform 0.12.6): Looking at the code, specifically the Normally, this would serve to carry existing settings over from Thus, you may be able to do some sort of check like:
I don't see where they are combined though, so I assume terraform is doing it at a lower level. One thing that could be done is adding a new field which allows the user to override the behavior of "fail if two gateways are provided" with an option to manually specify the type to provide, which then, under the hood, unsets all gateways other than the one specified and fails if the specified is not set. ex: resource "aws_route" "one" {
route_table_id = var.rtb
destination_cidr_block = var.cidr
nat_gateway_id = var.nat_gw_id
force_type = "nat_gateway"
} |
This has been released in version 3.34.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. 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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
This issue was originally opened by @peteromoon as hashicorp/terraform#13530. It was migrated here as part of the provider split. The original body of the issue is below.
If you change the destination type of an aws_route, for example from a network interface (network_interface_id) to an internet gateway (gateway_id), when you run
terraform apply
it fails with:This type of change could occur if you change a subnet from being "private" to "public" or change from using an instance as a NAT gateway to using an AWS NAT gateway.
Terraform Version
Affected Resource(s)
Please list the resources as a list, for example:
Terraform Configuration Files
Step 1, Terraform config
Step 2, Terraform config
Expected Behavior
The route to destination 0.0.0.0/0 is changed from a network interface to the internet gateway when the terraform config is changed and
terraform apply
is run.Actual Behavior
terraform apply
failed with an error when route is changed in terraform config from a network interface destination to an internet gateway destination.Steps to Reproduce
To reproduce:
terraform apply
terraform apply
References
I found this issue that is similar
The text was updated successfully, but these errors were encountered: