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

aws_route_table route block generates change on every plan #2390

Closed
szczad opened this issue Nov 21, 2017 · 8 comments
Closed

aws_route_table route block generates change on every plan #2390

szczad opened this issue Nov 21, 2017 · 8 comments
Labels
bug Addresses a defect in current functionality. service/ec2 Issues and PRs that pertain to the ec2 service.

Comments

@szczad
Copy link

szczad commented Nov 21, 2017

Terraform Version

Terraform v0.11.0

Affected Resource(s)

provider.aws 1.3.0 (unreleased)

Terraform Configuration Files

Version 1)

resource "aws_route_table" "route_1" {
  vpc_id = "${vpc_id}"
  route {
    cidr_block           = "0.0.0.0/0"
    network_interface_id = "${eni_id}"
    instance_id          = "${instance_id}"
  }
}

Version 2)

resource "aws_route_table" "route_2" {
  vpc_id = "${vpc_id}"
  route {
    cidr_block           = "0.0.0.0/0"
    network_interface_id = "${eni_id}"
  }
}

Output

Version 1)

aws_route_table.route_1: Modifying... (ID: rtb-abcd1234)
  route.#:                                    "0" => "1"
  route.3439688319.cidr_block:                "" => "0.0.0.0/0"
  route.3439688319.egress_only_gateway_id:    "" => ""
  route.3439688319.gateway_id:                "" => ""
  route.3439688319.instance_id:               "" => "i-01234567890"
  route.3439688319.ipv6_cidr_block:           "" => ""
  route.3439688319.nat_gateway_id:            "" => ""
  route.3439688319.network_interface_id:      "" => "eni-abcd1234"
  route.3439688319.vpc_peering_connection_id: "" => ""
  tags.%:                                     "0" => "2"
  tags.Name:                                  "" => "Tag 1"
  tags.Realm:                                 "" => "Realm 1"
Error: Error applying plan:
1 error(s) occurred:
* aws_route_table.route_1: 1 error(s) occurred:
* aws_route_table.route_1: InvalidParameterCombination: The request must contain exactly one of gatewayId, natGatewayId, networkInterfaceId, vpcPeeringConnectionId, egressOnlyInternetGatewayId or i
nstanceId
        status code: 400, request id: 00000000-0000-0000-0000-000000000000
Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.

Version 2)

  ~ aws_route_table.route_1
      route.1071501780.cidr_block:                "" => "0.0.0.0/0"
      route.1071501780.egress_only_gateway_id:    "" => ""
      route.1071501780.gateway_id:                "" => ""
      route.1071501780.instance_id:               "" => ""
      route.1071501780.ipv6_cidr_block:           "" => ""
      route.1071501780.nat_gateway_id:            "" => ""
      route.1071501780.network_interface_id:      "" => "eni-abcd1234"
      route.1071501780.vpc_peering_connection_id: "" => ""
      route.3439688319.cidr_block:                "0.0.0.0/0" => ""
      route.3439688319.egress_only_gateway_id:    "" => ""
      route.3439688319.gateway_id:                "" => ""
      route.3439688319.instance_id:               "i-01234567890" => ""
      route.3439688319.ipv6_cidr_block:           "" => ""
      route.3439688319.nat_gateway_id:            "" => ""
      route.3439688319.network_interface_id:      "eni-abcd1234" => ""
      route.3439688319.vpc_peering_connection_id: "" => ""

Plan: 0 to add, 1 to change, 0 to destroy.

Actual Behavior

  1. Terraform parser allows mutually exclusive options to be provided in "route" in "aws_route_table" resource (i.e: network_interface_id and instance_id).
  2. Terraform AWS provider generates change for configuration "version 2" every consecutive run. As a workaround one must tweak configuration adding "instance_id" so it looks like "version 1" to stop planner from creating "changes".

Expected Behavior

  1. Terraform parser detects that two or more mutually exclusive options are provided in same "route" configuration block
  2. Actual terraform plan does not generate change if "network_interface_id" is provided alone

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:
Version 1)

  1. Copy configuration "version 1"
  2. terraform plan
  3. terraform apply

Version 2)

  1. Copy configuration "version 2"
  2. terraform plan
  3. terraform apply
  4. terraform plan
@Ninir Ninir added the bug Addresses a defect in current functionality. label Nov 22, 2017
@nitinsatish
Copy link

I also facing the same issue on providing network_interface_id to aws_route_table

@kendrickm
Copy link

kendrickm commented Jan 25, 2018

I'm having the same issue
Terraform v0.11.2

  • provider.aws v0.1.4

Specifically adding/removing nat_gateway_id

@bflad bflad added the service/ec2 Issues and PRs that pertain to the ec2 service. label Jan 25, 2018
@abridgett
Copy link

TF: v0.11.5, provider.aws: v1.12.0
I've managed to find something that half-works for me. I'm using plain aws_route_tables.

Add just network_interface_id (do not put instance_id in yet - if you do then TF complains that these are incompatible and you have a half-created/updated routing table)

Now this will never settle down - it'll always detect "instance_id" is currently present.

So now add in instance_id to the aws_route_table and TF will accept that it's in sync and stop trying to make any "changes".

@alkersan
Copy link

Issue occurs in Terraform v0.11.8, provider.aws v1.32.0.

@github-actions
Copy link

github-actions bot commented Aug 6, 2020

Marking this issue as stale due to inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. Maintainers can also remove the stale label.

If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you!

@github-actions github-actions bot added the stale Old or inactive issues managed by automation, if no further action taken these will get closed. label Aug 6, 2020
@GaryGSC
Copy link

GaryGSC commented Aug 13, 2020

Bump. 🙂

@ghost ghost removed the stale Old or inactive issues managed by automation, if no further action taken these will get closed. label Aug 13, 2020
@ewbankkit
Copy link
Contributor

ewbankkit commented Jan 7, 2021

I'm going to close this issue as a duplicate of #1426 (an even earlier issue than this one 😞) so that we can concentrate discussion in the linked issue.
Please add any additional comments there.

@ghost
Copy link

ghost commented Feb 6, 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 Feb 6, 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

No branches or pull requests

9 participants