Skip to content

Commit

Permalink
fix(ec2): aws_launch_template default version should change as the la…
Browse files Browse the repository at this point in the history
…unch template configuration changes over time (#97)

Signed-off-by: Alvaro Lopez Hernandez <[email protected]>
  • Loading branch information
alv-lop authored Jan 10, 2023
1 parent bb126f3 commit f5f56a2
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions modules/ec2/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,12 @@ data "template_cloudinit_config" "cloud_init" {
}

resource "aws_launch_template" "kong" {
name_prefix = local.name
image_id = var.ami_id
instance_type = var.instance_type
key_name = var.key_name
user_data = var.user_data == null ? base64encode(data.template_cloudinit_config.cloud_init.rendered) : base64encode(var.user_data)
name_prefix = local.name
image_id = var.ami_id
instance_type = var.instance_type
key_name = var.key_name
user_data = var.user_data == null ? base64encode(data.template_cloudinit_config.cloud_init.rendered) : base64encode(var.user_data)
update_default_version = true

iam_instance_profile {
name = var.iam_instance_profile_name
Expand Down Expand Up @@ -183,7 +184,7 @@ resource "aws_autoscaling_group" "kong" {

launch_template {
name = aws_launch_template.kong.name
version = "$Latest"
version = aws_launch_template.kong.latest_version
}

desired_capacity = var.asg_desired_capacity
Expand Down

0 comments on commit f5f56a2

Please sign in to comment.