[Bug]: Regression in 5.39.0: Invalid address to set: []string{"root_block_device", "0", "tags_all"}
speller opened this issue · 8 comments
Terraform Core Version
1.7.1
AWS Provider Version
5.39.0
Affected Resource(s)
aws_instance
Expected Behavior
Changes applied successfully
Actual Behavior
╷
│ Error: reading EC2 Instance (i-028c47aa31b8e04ac): reading EC2 Instance (i-028c47aa31b8e04ac): Invalid address to set: []string{"root_block_device", "0", "tags_all"}
│
│ with module.app.data.aws_instance.instance[0],
│ on ec2-docker/main.tf line 163, in data "aws_instance" "instance":
│ 163: data "aws_instance" "instance" {
Relevant Error/Panic Output Snippet
No response
Terraform Configuration Files
resource "aws_instance" "instance" {
count = var.create_before_destroy ? 1 : 0
ami = var.ami
instance_type = var.instance_type
root_block_device {
delete_on_termination = true
volume_type = var.volume_type
volume_size = var.volume_size
}
user_data_base64 = base64encode(module.userdata.rendered)
user_data_replace_on_change = var.user_data_replace_on_change
vpc_security_group_ids = [aws_security_group.security-group.id]
subnet_id = var.aws_subnet_id
associate_public_ip_address = true
metadata_options {
http_tokens = var.require_imds_v2 ? "required" : "optional"
}
iam_instance_profile = aws_iam_instance_profile.iam-instance-profile.name
credit_specification {
cpu_credits = "standard"
}
lifecycle {
create_before_destroy = true
}
}
Steps to Reproduce
Apply changes
Debug Output
http.request.body=
| Action=DescribeVolumes&Version=2016-11-15&VolumeId.1=vol-09cc12ff0b1935d5e
http.request.header.authorization="AWS4-HMAC-SHA256 Credential=ASIA************LZ65/20240301/ap-northeast-1/ec2/aws4_request, SignedHeaders=content-length;content-type;host;x-amz-date;x-amz-security-token, Signature=*****" http.request.header.x_amz_security_token="*****" net.peer.name=ec2.ap-northeast-1.amazonaws.com rpc.system=aws-api tf_provider_addr=registry.terraform.io/hashicorp/aws @module=aws http.request_content_length=74 http.url=https://ec2.ap-northeast-1.amazonaws.com/ http.user_agent="APN/1.0 HashiCorp/1.0 Terraform/1.7.1 (+https://www.terraform.io) terraform-provider-aws/5.39.0 (+https://registry.terraform.io/providers/hashicorp/aws) aws-sdk-go/1.50.28 (go1.21.7; linux; amd64)" tf_rpc=ReadDataSource aws.region=ap-northeast-1 rpc.method=DescribeVolumes tf_req_id=113c5192-e4aa-68cd-e9ee-a1e6b720b04f tf_data_source_type=aws_instance tf_mux_provider="*schema.GRPCProviderServer" http.request.header.content_type="application/x-www-form-urlencoded; charset=utf-8" tf_aws.sdk=aws-sdk-go timestamp="2024-03-01T12:33:17.718+0900"
2024-03-01T12:33:17.816+0900 [DEBUG] provider.terraform-provider-aws_v5.39.0_x5: HTTP Response Received: http.response.header.cache_control="no-cache, no-store" http.response.header.date="Fri, 01 Mar 2024 03:33:17 GMT" http.response_content_length=1206 tf_mux_provider="*schema.GRPCProviderServer" @module=aws http.response.header.server=AmazonEC2 http.response.header.x_amzn_requestid=78231a94-74be-40e8-98de-3501a053c345 aws.region=ap-northeast-1 http.response.header.content_type=text/xml;charset=UTF-8 http.status_code=200 tf_aws.sdk=aws-sdk-go tf_data_source_type=aws_instance @caller=github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/v2@v2.0.0-beta.49/logger.go:157
http.response.body=
| <?xml version="1.0" encoding="UTF-8"?>
| <DescribeVolumesResponse xmlns="http://ec2.amazonaws.com/doc/2016-11-15/">
| <requestId>78231a94-74be-40e8-98de-3501a053c345</requestId>
| <volumeSet>
| <item>
| <volumeId>vol-09cc12ff0b1935d5e</volumeId>
| <size>8</size>
| <snapshotId>snap-0d2b9d28d25d27c2d</snapshotId>
| <availabilityZone>ap-northeast-1a</availabilityZone>
| <status>in-use</status>
| <createTime>2024-03-01T02:43:35.849Z</createTime>
| <attachmentSet>
| <item>
| <volumeId>vol-09cc12ff0b1935d5e</volumeId>
| <instanceId>i-028c47aa31b8e04ac</instanceId>
| <device>/dev/xvda</device>
| <status>attached</status>
| <attachTime>2024-03-01T02:43:35.000Z</attachTime>
| <deleteOnTermination>true</deleteOnTermination>
| </item>
| </attachmentSet>
| <volumeType>gp2</volumeType>
| <iops>100</iops>
| <encrypted>false</encrypted>
| <multiAttachEnabled>false</multiAttachEnabled>
| </item>
| </volumeSet>
| </DescribeVolumesResponse>
rpc.service=EC2 tf_rpc=ReadDataSource tf_provider_addr=registry.terraform.io/hashicorp/aws tf_req_id=113c5192-e4aa-68cd-e9ee-a1e6b720b04f http.duration=97 http.response.header.strict_transport_security="max-age=31536000; includeSubDomains" rpc.method=DescribeVolumes rpc.system=aws-api timestamp="2024-03-01T12:33:17.816+0900"
2024-03-01T12:33:17.816+0900 [ERROR] provider.terraform-provider-aws_v5.39.0_x5: [ERROR] setting state: Invalid address to set: []string{"root_block_device", "0", "tags_all"}
2024-03-01T12:33:17.817+0900 [ERROR] provider.terraform-provider-aws_v5.39.0_x5: Response contains error diagnostic: tf_data_source_type=aws_instance tf_req_id=113c5192-e4aa-68cd-e9ee-a1e6b720b04f @module=sdk.proto tf_proto_version=5.4 diagnostic_detail="" tf_provider_addr=registry.terraform.io/hashicorp/aws diagnostic_severity=ERROR tf_rpc=ReadDataSource @caller=github.com/hashicorp/terraform-plugin-go@v0.22.0/tfprotov5/internal/diag/diagnostics.go:58 diagnostic_summary="reading EC2 Instance (i-028c47aa31b8e04ac): reading EC2 Instance (i-028c47aa31b8e04ac): Invalid address to set: []string{\"root_block_device\", \"0\", \"tags_all\"}" timestamp="2024-03-01T12:33:17.816+0900"
2024-03-01T12:33:17.818+0900 [ERROR] vertex "module.app.data.aws_instance.instance[0]" error: reading EC2 Instance (i-028c47aa31b8e04ac): reading EC2 Instance (i-028c47aa31b8e04ac): Invalid address to set: []string{"root_block_device", "0", "tags_all"}
Panic Output
No response
Important Factoids
No response
References
Would you like to implement a fix?
None
Community Note
Voting for Prioritization
- Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
- Please see our prioritization guide for information on how we prioritize.
- 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.
Volunteering to Work on This Issue
- If you are interested in working on this issue, please leave a comment.
- If this would be your first contribution, please review the contribution guide.
This bug is not reproducible in the provider version 5.38.0. If I set this:
terraform {
required_providers {
aws = {
version = "<= 5.38"
}
}
}
Then changes are applied successfully.
Can confirm, this is an issue with v5.39.0.
Also, just to note this fails during plan too, not just apply.
Same for me with "data.aws_instance". Rollback to 5.38.0 fixed it
We have the same error with v5.39.0. Yesterday it still worked in version v5.38.0.
This syntax avoids the bad version without restricting it with a maximum:
aws = {
source = "hashicorp/aws"
version = ">=5.0, !=5.39"
}
This functionality has been released in v5.39.1 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.
For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!