skip to Main Content

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


  1. You have to use update_default_version:

    Whether to update Default Version each update. Conflicts with default_version

    Login or Signup to reply.
  2. 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

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search