I made changes to lifecycle
block from true
to false
for create_before_destroy
parameter in below code and did a terraform plan. It did not detect a change. Am I doing something wrong ?
Shouldn't it create a new launch template version ?
resource "aws_launch_template" "yct_asg_temp" {
name = "yct-lt-${var.env_id}-${random_string.random.result}"
image_id = data.aws_ami.control_tower.id
instance_type = var.instance_type
ebs_optimized = true
key_name = var.ec2_key_name
update_default_version = true
iam_instance_profile {
arn = aws_iam_instance_profile.ssm_instance_profile.arn
}
network_interfaces {
security_groups = [aws_security_group.yct_sg.id]
subnet_id = module.vpc.public_subnets[0]
}
lifecycle {
create_before_destroy = false
}
block_device_mappings {
device_name = "/dev/sda1"
ebs {
volume_type = "gp3"
volume_size = var.ebs_root_volume_size
encrypted = true
delete_on_termination = true
}
}
user_data = base64encode(local.user_data)
tag_specifications {
resource_type = "instance"
tags = merge({ Group = "ec2-instance" }, var.tags)
}
tag_specifications {
resource_type = "volume"
tags = var.tags
}
}