terraform-provider-aws: Since v3.68.0 `aws_launch_template` no longer reports `latest_version` until after changes are applied
Community Note
- Please vote on this issue by adding a ๐ reaction to the original issue to help the community and maintainers prioritize this request
- 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
- If you are interested in working on this issue or have submitted a pull request, please leave a comment
Terraform CLI and Terraform AWS Provider Version
Terraform v0.14.6
+ provider registry.terraform.io/hashicorp/aws v3.68.0
+ provider registry.terraform.io/hashicorp/random v3.1.0
Affected Resource(s)
- aws_launch_template
Expected Behavior
Expect aws_launch_template.<resource_name>.latest_version to update during apply stages.
Actual Behavior
aws_launch_template.<resource_name>.latest_version does not update during apply stages.
Steps to Reproduce
resource "random_pet" "asg_name" {
separator = "-"
length = 2
keepers = {
# Generate a new pet name each time we switch the launch template
lt_name = "${aws_launch_template.this.name}+${aws_launch_template.this.latest_version}"
}
}
Using AWS Provider v3.67.0, this resulted in:
+/- resource "random_pet" "asg_name" {
~ id = "key-dove" -> (known after apply)
~ keepers = {
- "lt_name" = "example-launch-template-20200311171713363100000001+267"
} -> (known after apply) # forces replacement
# (2 unchanged attributes hidden)
}
With AWS Provider v3.68.0, the resource is not updated until a 2nd run with terrafrom apply.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 57
- Comments: 16 (4 by maintainers)
We have the same issue
We currently have a failing acceptance test that is showing this behavior:
It passes on v3.67.0:
Just did a test with 3.69.0 provider and found the
latest_versionissue still existsI can confirm that v3.71.0 fixes the issue.
I had excluded provider version
3.68.0but with3.69.0I got the error back. I will keep my production using< 3.68.0until it is fixedThis functionality has been released in v3.71.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!
@ewbankkit is working on it. See https://github.com/hashicorp/terraform-plugin-sdk/pull/829.
In meantime you could pin the AWS Provider version to v3.67.0. In our case, we just needed the
latest_versionas an indicator that the launch template has changed (not necessarily the latest), so weโve replacedlatest_versionwith thesha256()function on the launch templateโsuser_data(which for us will always change when the version changes).Slightly easier way to replicate this is just to output
latest_version. When you update the launch template resource, the output value does not change. A subsequent apply (with no code changes) then causes the output to be updated.