hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.84k stars 9.19k forks source link

[Bug]: aws_imagebuilder_image_recipe data source cannot set block_device_mapping.0.ebs.0.delete_on_termination value #39927

Closed omerakcasbp closed 2 weeks ago

omerakcasbp commented 2 weeks ago

Terraform Core Version

1.6.2

AWS Provider Version

5.73.0

Affected Resource(s)

aws_imagebuilder_image_recipe data source

Expected Behavior

Image recipe data source select ebs delete_on_termination correctly.

Actual Behavior

Data source cannot set block_device_mapping.0.ebs.0.delete_on_termination value on state with error

block_device_mapping.0.ebs.0.delete_on_termination: '' expected type 'bool', got unconvertible type 'string', value: 'true'

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

data "aws_imagebuilder_image_recipes" "recipes" { owner = "Self" }

data "aws_imagebuilder_image_recipe" "recipes" { for_each = data.aws_imagebuilder_image_recipes.recipes.arns arn = each.value }

Steps to Reproduce

  1. Create multiple image recipes
  2. Get them with aws_imagebuilder_image_recipes resource
  3. Foreach gathered arns from step 2 for resource aws_imagebuilder_image_recipe
  4. Run a plan

Debug Output

2024-10-29T14:23:49.935Z [DEBUG] provider.terraform-provider-aws_v5.73.0_x5: HTTP Response Received: @module=aws http.response.header.access_control_allow_origin="*" http.status_code=200 tf_aws.sdk=aws-sdk-go-v2 tf_rpc=ReadDataSource http.response.header.date="Tue, 29 Oct 2024 14:23:49 GMT" tf_data_source_type=aws_imagebuilder_image_recipe tf_req_id=be8f0d5d-a605-a7c6-d1c9-13a6ed109215 http.response.header.access_control_allow_methods=GET http.response.header.x_amzn_trace_id=Root=1-6720eff5-0508cb33ae1bf61a3735f079;Parent=00102dc722112f02;Sampled=0;Lineage=1:72baff13:0 tf_mux_provider="*schema.GRPCProviderServer" http.response.header.content_type=application/json http.response_content_length=1467 http.response.header.x_amz_apigw_id=XXXXX rpc.system=aws-api http.response.header.x_amzn_requestid=XXXXX rpc.method=GetImageRecipe rpc.service=imagebuilder tf_provider_addr=registry.terraform.io/hashicorp/aws http.response.header.access_control_allow_headers="Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token,X-Amz-Content-Sha256,X-Amz-User-Agent,amz-sdk-invocation-id,amz-sdk-request" tf_aws.signing_region="" @caller=github.com/hashicorp/aws-sdk-go-base/v2@v2.0.0-beta.58/logging/tf_logger.go:45 http.duration=145
http.response.body=
| {
|   "imageRecipe" : {
|     "arn" : "arn:aws:imagebuilder:XXX-1:XXXXX",
|     "name" : "XXXX",
|     "platform" : "Windows",
|     "owner" : "XXXXX",
|     "version" : "1.0.2",
|     "components" : [ {
|       "componentArn" : "arn:aws:imagebuilder:XXXXXXXX:component/XXXXX/1.0.2/1"
|     }, {
|       "componentArn" : "arn:aws:imagebuilder:XXXXX:aws:component/XXXX/x.x.x"
|     }, {
|       "componentArn" : "arn:aws:imagebuilder:XXXX:XXXXX:component/XXXX/1.0.0/1"
|     } ],
|     "parentImage" : "arn:aws:imagebuilder:XXX",
|     "blockDeviceMappings" : [ {
|       "deviceName" : "/dev/sda1",
|       "ebs" : {
|         "encrypted" : true,
|         "deleteOnTermination" : true,
|         "kmsKeyId" : "XXXXX",
|         "volumeSize" : 30,
|         "volumeType" : "gp3"
|       }
|     } ],
|     "workingDirectory" : "/var/tmp"
|   },
|   "requestId" : "3a17aa5b-ba2c-41da-836f-41a9cc140253"
| }
timestamp=2024-10-29T14:23:49.934Z
2024-10-29T14:23:49.935Z [ERROR] provider.terraform-provider-aws_v5.73.0_x5: [ERROR] setting state: block_device_mapping.0.ebs.0.delete_on_termination: '' expected type 'bool', got unconvertible type 'string', value: 'true'
2024-10-29T14:23:49.935Z [ERROR] provider.terraform-provider-aws_v5.73.0_x5: Response contains error diagnostic: tf_proto_version=5.6 diagnostic_severity=ERROR tf_req_id=be8f0d5d-a605-a7c6-d1c9-13a6ed109215 diagnostic_detail="" tf_data_source_type=aws_imagebuilder_image_recipe tf_provider_addr=registry.terraform.io/hashicorp/aws @caller=github.com/hashicorp/terraform-plugin-go@v0.24.0/tfprotov5/internal/diag/diagnostics.go:58 diagnostic_summary="setting block_device_mapping: block_device_mapping.0.ebs.0.delete_on_termination: '' expected type 'bool', got unconvertible type 'string', value: 'true'" tf_rpc=ReadDataSource @module=sdk.proto timestamp=2024-10-29T14:23:49.935Z
2024-10-29T14:23:49.935Z [ERROR] vertex "data.aws_imagebuilder_image_recipe.recipes[\"arn:aws:imagebuilder:XXXX:XXXXX:image-recipe/XXXXX/1.0.2\"]" error: setting block_device_mapping: block_device_mapping.0.ebs.0.delete_on_termination: '' expected type 'bool', got unconvertible type 'string', value: 'true'

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

None

github-actions[bot] commented 2 weeks ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

ewbankkit commented 2 weeks ago

Resource

https://github.com/hashicorp/terraform-provider-aws/blob/ceef509c6d597f7ce5fcc8c6cafb02d028b67816/internal/service/imagebuilder/image_recipe.go#L60-L73

Data source

https://github.com/hashicorp/terraform-provider-aws/blob/ceef509c6d597f7ce5fcc8c6cafb02d028b67816/internal/service/imagebuilder/image_recipe_data_source.go#L40-L48

github-actions[bot] commented 2 weeks ago

[!WARNING] This issue has been closed, meaning that any additional comments are hard for our team to see. Please assume that the maintainers will not see them.

Ongoing conversations amongst community members are welcome, however, the issue will be locked after 30 days. Moving conversations to another venue, such as the AWS Provider forum, is recommended. If you have additional concerns, please open a new issue, referencing this one where needed.

github-actions[bot] commented 2 weeks ago

This functionality has been released in v5.74.0 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!