I am trying to set the the latest version to default in the launch template using Terraform.
You can do this quite easily in the AWS console:
enter image description here
But I can’t seem to find in TF documentation a way to do so.
I am using AWS provider 4.14 in TF.
There is an option to set the latest version but it expects an integer https://registry.terraform.io/providers/hashicorp/aws/4.14.0/docs/resources/launch_template#latest_version
I would like to set that whenever there is an update to the launch template a new version will be created and set to default.
Any suggestions will be appreciated.
Thanks!
2
Answers
You have to use update_default_version:
You can use update_default_version=true parameter inside resource block, which will make terraform to set latest version as default one.
https://registry.terraform.io/providers/hashicorp/aws/4.14.0/docs/resources/launch_template#update_default_version
here is the doc about that parameter