Search code examples
amazon-web-servicesterraformlaunch-template

How can I update the launch template version to be set to latest in Terraform?


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!


Solution

  • You have to use update_default_version:

    Whether to update Default Version each update. Conflicts with default_version