Skip to content
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

Inline routes not removed from aws_route_table. #199

Closed
hashibot opened this issue Jun 13, 2017 · 6 comments · Fixed by #16979
Closed

Inline routes not removed from aws_route_table. #199

hashibot opened this issue Jun 13, 2017 · 6 comments · Fixed by #16979
Assignees
Labels
bug Addresses a defect in current functionality. service/ec2 Issues and PRs that pertain to the ec2 service.
Milestone

Comments

@hashibot
Copy link

This issue was originally opened by @clstokes as hashicorp/terraform#7632. It was migrated here as part of the provider split. The original body of the issue is below.


When an inline route is removed from an aws_route_table resource. Terraform does not notice the change and the route is never removed from the route table at AWS. If an inline route is added, Terraform adds the route as expected.

Terraform Version

  • 0.6.10
  • 0.6.16
  • v0.7.0-rc2

Affected Resource(s)

  • aws_route_table

Terraform Configuration Files

resource "aws_vpc" "main" { cidr_block = "10.0.0.0/16" }
resource "aws_internet_gateway" "main" { vpc_id = "${aws_vpc.main.id}" }

resource "aws_route_table" "private" {
  vpc_id = "${aws_vpc.main.id}"

  // Comment out this route block after creation to reproduce behavior.
  route {
    cidr_block = "0.0.0.0/0"
    gateway_id = "${aws_internet_gateway.main.id}"
  }
}

Debug Output

https://gist.github.com/clstokes/884d65b4b75dfa419174cc2a5b4e8a21

Expected Behavior

The route should have been removed from the route table.

Actual Behavior

No changes were planned or applied.

Steps to Reproduce

  1. terraform apply
  2. Comment out or remove route { ... }
  3. terraform apply again and see no changes.
@hashibot hashibot added the bug Addresses a defect in current functionality. label Jun 13, 2017
@radeksimko radeksimko added service/ec2 Issues and PRs that pertain to the ec2 service. and removed service/ec2 Issues and PRs that pertain to the ec2 service. labels Jan 25, 2018
@azhurbilo
Copy link

may be someone know workaround how to move part of state from "aws_route_table" (inline route {} ) to specific "aws_route" resource?

@tdmalone
Copy link
Contributor

tdmalone commented Nov 7, 2019

fwiw, I can replicate this issue on:

Terraform v0.11.14
+ provider.aws v2.34.0

@markbaird
Copy link

I'm seeing this same issue today with:

Terraform v0.12.20
+ provider.aws v2.58.0

@ewbankkit
Copy link
Contributor

The route attribute of the aws_route_table resource is handled differently than most other nested block attributes.
From the documentation:

This argument is processed in attribute-as-blocks mode.

and from the Attribute as Blocks documentation:

However, in some cases existing provider features were relying on the conflation of these two concepts in the language of Terraform v0.11 and earlier, using nested block syntax in most cases but using argument syntax to represent explicitly the idea of removing all existing objects of that type, since the absence of any blocks was interpreted as "ignore any existing objects".

, so specifying no route attributes indicates that any existing routes are ignored.
To remove all routes, use the route = [] syntax.

I agree that this is not at all clear from the documentation and will leave this issue open to address that.

@ghost
Copy link

ghost commented Apr 1, 2021

This has been released in version 3.35.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!

@ghost
Copy link

ghost commented Apr 26, 2021

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!

@ghost ghost locked as resolved and limited conversation to collaborators Apr 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/ec2 Issues and PRs that pertain to the ec2 service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants