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

[version 3.0.0] unsupported attribute network_interface_id on aws_instance resource #14431

Closed
emulanob opened this issue Jul 31, 2020 · 14 comments
Labels
bug Addresses a defect in current functionality. service/ec2 Issues and PRs that pertain to the ec2 service. service/ecs Issues and PRs that pertain to the ecs service. upstream-terraform Addresses functionality related to the Terraform core binary.

Comments

@emulanob
Copy link

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform CLI and Terraform AWS Provider Version

Affected Resource(s)

  • aws_instance

Expected Behavior

terraform apply should work as usual

Actual Behavior


  on ../../../modules/instance/main.tf line 61:
  61: resource "aws_instance" "instance_no_ebs" {

Instance
module.nomad_servers.module.nomad_server_instances.module.instance.aws_instance.instance_no_ebs[1]
data could not be decoded from the state: unsupported attribute
"network_interface_id".

Steps to Reproduce

  1. terraform init to download latest provider version (3.0.0)
  2. terraform apply

Important Factoids

  • error is not presented during plan, only apply
  • reverting to version 2.70.0 of the provider fixes the issue,
@ghost ghost added the service/ec2 Issues and PRs that pertain to the ec2 service. label Jul 31, 2020
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Jul 31, 2020
@emulanob
Copy link
Author

Most definitely caused by 3586a1a#diff-28aade55afa0cda57279a9d35d523488.

The error had already been bypassed on plan because the attribute is used in an output which I wrapped in a try() function, Therefore it could be planned successfully but not applied, when terraform tries to retrieve the attribute from the state.

@jameshounshell
Copy link

jameshounshell commented Jul 31, 2020

We see a very similar problem, that actually breaks in the plan stage. This affects placement_strategy for ECS service which is now I believe ordered_placement_strategy. We probably could bypass by destroying and redeploying the infra but it would be nice to not have to.

terraform validate
Success! The configuration is valid.

terraform plan
Error: Invalid resource instance data in state

  on .terraform/modules/ecs_app/ecs_service/main.tf line 28:
  28: resource "aws_ecs_service" "service" {

Instance module.ecs_app.aws_ecs_service.service data could not
be decoded from the state: unsupported attribute "placement_strategy".

make: *** [plan] Error 1

@bflad
Copy link
Contributor

bflad commented Jul 31, 2020

Hi folks 👋 Thank you for reporting this issue and apologies for the frustrating behavior. Something is certainly amiss with the physical removal of the attributes from the provider schema, but usually Terraform core handles these just fine.

It would be very helpful if you all could provide the following information, so we can start troubleshooting this:

  • Terraform CLI version
  • Steps (e.g. commands ran, including upgrading the Terraform AWS Provider) that led to this error
  • Snippet of Terraform configuration associated with the resource reporting the error
  • A Gist with trace logging enabled so we can further troubleshoot. If you are worried about any sensitive data, it can be encrypted with the HashiCorp GPG Key or redacted as necessary.

Hopefully with those outlined, we can figure out root cause. Relevant Terraform core logic triggering the error.

@bflad bflad added bug Addresses a defect in current functionality. service/ecs Issues and PRs that pertain to the ecs service. upstream-terraform Addresses functionality related to the Terraform core binary. and removed needs-triage Waiting for first response or review from a maintainer. labels Jul 31, 2020
@Starttoaster
Copy link

  • TF CLI 0.12.29, using the hashicorp/terraform:light image in docker hub
  • terraform validate or terraform apply
  • Having an output is what led to this error for me:
output "network_interface_id" {
  description = "ID of the network interface that was created with the instance."
  value       = aws_instance.<module_name>.network_interface_id
}

@emulanob
Copy link
Author

emulanob commented Aug 2, 2020

In my case it's also because of an output.

@kimor79
Copy link

kimor79 commented Aug 3, 2020

I have more info in #14458 but noting here for compactness. In my case plan fails because my existing state was generated with 2.70.0 and has removed attributes listed:

    {
      "module": "module.my-module",
      "mode": "data",
      "type": "aws_region",
      "name": "main",
      "provider": "provider[\"registry.terraform.io/hashicorp/aws\"].my-module",
      "instances": [
        {
          "schema_version": 0,
          "attributes": {
            "current": null,
            "description": "US East (N. Virginia)",
            "endpoint": "ec2.us-east-1.amazonaws.com",
            "id": "us-east-1",
            "name": "us-east-1"
          }
        }
      ]
    },

current was removed from the aws_region datasource in 3.0.0

@mimozell
Copy link

mimozell commented Aug 4, 2020

Issue is happening to me as well when going from aws provider version 2.70.0 to 3.0.0

  • Version: Terraform v0.13.0-rc1, provider registry.terraform.io/hashicorp/aws v3.0.0
  • Action: terraform apply or terraform destroy
  • Resource:
resource aws_route53_zone external {
  name = var.domain-name
  comment = "${var.environment}-external-zone"

  tags = {
    Environment = var.environment
  }
}
  • Error: ...data could not be decoded from the state: unsupported attribute "vpc_id"

Edit:
Also seeing the same issue with the following:
data aws_availability_zones available {}
Error: ...data could not be decoded from the state: unsupported attribute "blacklisted_names".

And:
data aws_iam_role iam_for_lambda {
Error: ...data could not be decoded from the state: unsupported attribute "assume_role_policy_document".

@bflad
Copy link
Contributor

bflad commented Aug 5, 2020

Please note that I have filed a bug report upstream with Terraform core, where this error is being generated: hashicorp/terraform#25752

@RayOei
Copy link

RayOei commented Aug 11, 2020

Just updated to v0.13 and the terraform **plan** fails.

Terraform v0.13.0

  • provider registry.terraform.io/-/aws v3.1.0
  • provider registry.terraform.io/hashicorp/aws v3.1.0

Commands used:

terraform 0.13update (added new required_providers)
terraform init
terraform plan

Failure (multiple times for the same aws_instance resource):

Error: Invalid resource instance data in state

  on main.tf line 313:
 313: resource "aws_instance" "instance" {

Instance aws_instance.instance data could not be decoded from the state:
unsupported attribute "network_interface_id".

Code snippet:

resource "aws_instance" "instance" {
  ami           = var.amis[format("%s_%s_%s_%s", var.ami_name, var.region, var.ubu_version, var.ebs_size)]
  instance_type = var.instance_type

  vpc_security_group_ids = [
    aws_security_group.ssh.id,
    aws_security_group.http.id,
    aws_security_group.openvpn.id,
  ]

  subnet_id = aws_subnet.default.id

  key_name = var.use_existingKey ? var.fixed_key_name : aws_key_pair.auth[0].id

  volume_tags = {
    Name = format("%s-ws_%s-ami_%s", var.basename, terraform.workspace, var.ami_name)
  }

  tags = {
    Name = format("%s-ws_%s-ami_%s", var.basename, terraform.workspace, var.ami_name)
  }
}

@bflad
Copy link
Contributor

bflad commented Aug 12, 2020

Hi folks 👋 A fix for this particular Terraform state handling issue was merged upstream in the Terraform CLI code and will release with Terraform CLI version 0.13.1 in the coming days.

If you happen to have a reproducible case of this issue with only Terraform CLI 0.12.x, please create a new bug report issue in the hashicorp/terraform repository with all the template details and the teams will triage further. Thanks.

@andresvia
Copy link

Is there a workaround meanwhile?

Hi folks 👋 A fix for this particular Terraform state handling issue was merged upstream in the Terraform CLI code and will release with Terraform CLI version 0.13.1 in the coming days.

If you happen to have a reproducible case of this issue with only Terraform CLI 0.12.x, please create a new bug report issue in the hashicorp/terraform repository with all the template details and the teams will triage further. Thanks.

@dinvlad
Copy link

dinvlad commented Aug 24, 2020

@andresvia alas, you have to manually edit the state file to exclude the deprecated attributes for now, I think. That worked for us at least.

@dinvlad
Copy link

dinvlad commented Aug 24, 2020

More specifically, as described here: hashicorp/terraform#25752 (comment)

@ghost
Copy link

ghost commented Sep 12, 2020

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 and limited conversation to collaborators Sep 12, 2020
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. service/ecs Issues and PRs that pertain to the ecs service. upstream-terraform Addresses functionality related to the Terraform core binary.
Projects
None yet
Development

No branches or pull requests

9 participants