Skip to content

Commit

Permalink
fix: Use the default launch_template_version to determine latest versus
Browse files Browse the repository at this point in the history
default launch_template version.

Signed-off-by: Benjamin Ash <bash@intelerad.com>
  • Loading branch information
Benjamin Ash committed May 19, 2021
1 parent 5b422fd commit 604fb9a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
1 change: 0 additions & 1 deletion examples/instance_refresh/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,6 @@ module "eks" {
public_ip = true
metadata_http_put_response_hop_limit = 3
use_latest_version = true
update_default_version = true
instance_refresh_triggers = ["tag"]
tags = [
{
Expand Down
3 changes: 1 addition & 2 deletions local.tf
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ locals {
root_block_device_name = data.aws_ami.eks_worker.root_device_name # Root device name for workers. If non is provided, will assume default AMI was used.
root_kms_key_id = "" # The KMS key to use when encrypting the root storage device
launch_template_id = null # The id of the launch template used for managed node_groups
launch_template_version = "$Latest" # The latest version of the launch template to use in the autoscaling and node groups. Must be explicitly set in `worker_groups_launch_template`.
use_latest_version = true # Set the autoscaling group to use the latest version of the launch template, otherwise the default template version will be used. Ignored when `launch_template_version` is set in `worker_groups_launch_template`.
launch_template_version = "$Latest" # The latest version of the launch template to use in the autoscaling group
update_default_version = false # Update the autoscaling group launch template's default version upon each update
launch_template_placement_tenancy = "default" # The placement tenancy for instances
launch_template_placement_group = null # The name of the placement group into which to launch the instances, if any.
Expand Down
12 changes: 6 additions & 6 deletions workers_launch_template.tf
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@ resource "aws_autoscaling_group" "workers_launch_template" {
"launch_template_version",
lookup(
var.worker_groups_launch_template[count.index],
"use_latest_version",
local.workers_group_defaults["use_latest_version"]
)
"launch_template_version",
local.workers_group_defaults["launch_template_version"]
) == "$Latest"
? aws_launch_template.workers_launch_template.*.latest_version[count.index]
: aws_launch_template.workers_launch_template.*.default_version[count.index]
)
Expand Down Expand Up @@ -177,9 +177,9 @@ resource "aws_autoscaling_group" "workers_launch_template" {
"launch_template_version",
lookup(
var.worker_groups_launch_template[count.index],
"use_latest_version",
local.workers_group_defaults["use_latest_version"]
)
"launch_template_version",
local.workers_group_defaults["launch_template_version"]
) == "$Latest"
? aws_launch_template.workers_launch_template.*.latest_version[count.index]
: aws_launch_template.workers_launch_template.*.default_version[count.index]
)
Expand Down

0 comments on commit 604fb9a

Please sign in to comment.