Terraform Version
Terraform Configuration Files
https://gist.github.com/grimm26/e973a686526f9d054224d251b713aae6
Expected Behavior
The outputs of the resource should still be available, i.e. the state of the resource should be correct.
Actual Behavior
The state of the resource seems incorrect and the only way forward is to manually edit the state file or move the resource back to its original place.
Steps to Reproduce
Made a bucket
Changed the s3_bucket module's aws_s3_bucket to no longer be counted. did a terraform state mv 'module.bucket.aws_s3_bucket.b[0]' module.bucket.aws_s3_bucket.b
a subsequent apply or plan will show:
Error: Unsupported attribute
on s3_bucket/main.tf line 15, in output "id":
15: value = aws_s3_bucket.b.id
|----------------
| aws_s3_bucket.b is empty tuple
This value does not have any attributes.
In the second state file after I changed the module and moved the aws_S3_bucket resource, I think the problem is that even though I removed the count and it removed the "index_key": 0, entry from resources[0]{"instances"}[0]{"attributes"} it did not remove "each": "list" from resources[0]
Additional Context
References
#23582 seems to have introduced this.
Terraform Version
Terraform Configuration Files
https://gist.github.com/grimm26/e973a686526f9d054224d251b713aae6
Expected Behavior
The outputs of the resource should still be available, i.e. the state of the resource should be correct.
Actual Behavior
The state of the resource seems incorrect and the only way forward is to manually edit the state file or move the resource back to its original place.
Steps to Reproduce
In the second state file after I changed the module and moved the aws_S3_bucket resource, I think the problem is that even though I removed the count and it removed the
"index_key": 0,entry fromresources[0]{"instances"}[0]{"attributes"}it did not remove"each": "list"fromresources[0]Additional Context
References
#23582 seems to have introduced this.