terraform apply
should work as usual
```Error: Invalid resource instance data in state
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".
```
terraform init
to download latest provider version (3.0.0)terraform apply
plan
, only apply
Most definitely caused by https://github.com/terraform-providers/terraform-provider-aws/pull/14001/commits/3586a1a9b5ed6f121a64f022c22b405476f44d24#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.
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
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:
Hopefully with those outlined, we can figure out root cause. Relevant Terraform core logic triggering the error.
terraform validate
or terraform apply
output "network_interface_id" {
description = "ID of the network interface that was created with the instance."
value = aws_instance.<module_name>.network_interface_id
}
In my case it's also because of an output.
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
Issue is happening to me as well when going from aws provider version 2.70.0 to 3.0.0
terraform apply
or terraform destroy
resource aws_route53_zone external {
name = var.domain-name
comment = "${var.environment}-external-zone"
tags = {
Environment = var.environment
}
}
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".
Please note that I have filed a bug report upstream with Terraform core, where this error is being generated: https://github.com/hashicorp/terraform/issues/25752
Just updated to v0.13 and the terraform **plan**
fails.
Terraform v0.13.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)
}
}
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.
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.
@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.
More specifically, as described here: https://github.com/hashicorp/terraform/issues/25752#issuecomment-672217777
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!
Most helpful comment
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.