Hi all,
When I change the user-data of launch configuration resource and run the plan I get:
-/+ module.module1.aws_launch_configuration.host
associate_public_ip_address: "true" => "true"
ebs_block_device.#: "0" => "<computed>"
ebs_optimized: "false" => "<computed>"
enable_monitoring: "true" => "true"
[...]
user_data: "75d8daae5d70b48778bb3fa14e47f829d234040a" => "aadb60447e52f52a1e0dfc132ea5a5a1c2a251de" (forces new resource)
so obviously new LC resource will get created. That's fine and I can see the LC in the AWS console changing the name suffix and user-data being updated. I can also see a change for the ASG i.e. new ASG gets created with reference to the new LC. However after applying the changes nothing happens to the currently running instance in the ASG, it keeps running instead being replaced with new one.
My resource definition is:
resource "aws_autoscaling_group" "host" {
name = "${var.tag}-host-asg"
availability_zones = ["${var.zones}"]
vpc_zone_identifier = ["${var.subnet_ids}"]
max_size = 1
min_size = 1
health_check_grace_period = 60
default_cooldown = 60
health_check_type = "EC2"
desired_capacity = 1
force_delete = true
launch_configuration = "${
aws_launch_configuration.host.name}"
lifecycle {
create_before_destroy = true
}
}
resource "aws_launch_configuration" "host" {
name_prefix = "${var.tag}-host-lc-"
image_id = "${var.image}"
instance_type = "${var.instance_type}"
iam_instance_profile = "${
aws_iam_instance_profile.host.name}"
key_name = "${var.key_name}"
security_groups = ["${
aws_security_group.host.id}"]
associate_public_ip_address = true
user_data = "${data.template_file.host.rendered}"
lifecycle {
create_before_destroy = true
}
}
Any idea why is this happening?
Thanks,
Igor