Closed sim1e097cd closed 1 year ago
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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Description
If ignore_ami_changes is set to true the resource inside the module changes its name from module.ec2_instance.aws_instance.this[0] to module.ec2_instance.aws_instance.ignore_ami[0]. This breaks the output generation that does not consider a different name for the resource.
The solution consists in adding a multiple choice in the try(...)
Versions
Module version [Required]:
Terraform version: Terraform v1.4.6 on darwin_arm64
Provider version(s): provider registry.terraform.io/hashicorp/aws v5.5.0
Reproduction Code [Required]
Steps to reproduce the behavior:
Execute a plan setting ignore_ami_changes to true with this local
root_volumes = sum([for i in module.ec2_instance.root_block_device : try(i.volume_size, 0)])
Expected behavior
A valid value for the output
Actual behavior
A non existing value for the output
Terminal Output Screenshot(s)
https://github.com/terraform-aws-modules/terraform-aws-ec2-instance/assets/72647533/0c519276-5ee3-4f49-b295-ad4e3a5cd810
Possible solution