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

Time:07-20

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!

CodePudding user response:

You have to use update_default_version:

Whether to update Default Version each update. Conflicts with default_version

CodePudding user response:

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

  • Related