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 resource generates constant diff in terraform plan when specifying only the network_interface_id as a route target #27426

Closed
ttcl19 opened this issue Jan 6, 2021 · 2 comments

Comments

@ttcl19
Copy link

ttcl19 commented Jan 6, 2021

Terraform Version

Terraform v0.13.5
AWS Provider version v3.22.0

Terraform Configuration Files

resource "aws_route_table" "aws_rtb" {
  vpc_id = module.foo_vpc.vpc_id
  tags = {
    Name = "rtb"
  }

  dynamic "route" {
    for_each = local.dhcp_route
    content {
      cidr_block                = route.key // This is a CIDR string
      egress_only_gateway_id    = ""
      gateway_id                = ""
      local_gateway_id          = ""
      ipv6_cidr_block           = ""
      nat_gateway_id            = ""
      network_interface_id      = route.value[1] // This is a string in a list
      transit_gateway_id        = ""
      vpc_peering_connection_id = ""
      vpc_endpoint_id           = ""
    }
  }

Debug Output

      + {
          + cidr_block                = "172.30.92.0/24"
          + egress_only_gateway_id    = ""
          + gateway_id                = ""
          + instance_id               = ""
          + ipv6_cidr_block           = ""
          + local_gateway_id          = ""
          + nat_gateway_id            = ""
          + network_interface_id      = "eni-1234"
          + transit_gateway_id        = ""
          + vpc_endpoint_id           = ""
          + vpc_peering_connection_id = ""
        },
      - {
          - cidr_block                = "172.30.92.0/24"
          - egress_only_gateway_id    = ""
          - gateway_id                = ""
          - instance_id               = "i-5678"
          - ipv6_cidr_block           = ""
          - local_gateway_id          = ""
          - nat_gateway_id            = ""
          - network_interface_id      = "eni-1234"
          - transit_gateway_id        = ""
          - vpc_endpoint_id           = ""
          - vpc_peering_connection_id = ""
        },

Expected Behavior

No diff for existing routes.

And being able to push a new route with network_interface_id as a target, either by specifying both the instance_id AND the network_interface_id, or only the network_interface_id but without it creating diffs afterwards in terraform plan (due to not specifying instance_id)

Actual Behavior

We see a permanent diff for existing routes because the instance ID isn't in the configuration, but we can't explicitly set the instance_id because only one of instance_id or network_interface_id can be set for terraform apply.

Steps to Reproduce

Create an aws_route resource with route config blocks.

@ghost
Copy link

ghost commented Jan 6, 2021

This issue has been automatically migrated to hashicorp/terraform-provider-aws#16999 because it looks like an issue with that provider. If you believe this is not an issue with the provider, please reply to hashicorp/terraform-provider-aws#16999.

@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 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.

@ghost ghost locked as resolved and limited conversation to collaborators Feb 6, 2021
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants