Enable create_before_destroy for ASG and enable force_delete to be configured (#250)

* Allow force_delete to be passed to the ASG, and set ASG so that it will create before deletion.

* Set default

* Adding CHANGELOG
This commit is contained in:
Stefan Sedich
2019-01-24 01:48:26 -08:00
committed by Max Williams
parent 89461903b4
commit 8473c69f25
4 changed files with 10 additions and 2 deletions

View File

@@ -5,6 +5,7 @@ resource "aws_autoscaling_group" "workers" {
desired_capacity = "${lookup(var.worker_groups[count.index], "asg_desired_capacity", local.workers_group_defaults["asg_desired_capacity"])}"
max_size = "${lookup(var.worker_groups[count.index], "asg_max_size", local.workers_group_defaults["asg_max_size"])}"
min_size = "${lookup(var.worker_groups[count.index], "asg_min_size", local.workers_group_defaults["asg_min_size"])}"
force_delete = "${lookup(var.worker_groups[count.index], "asg_force_delete", local.workers_group_defaults["asg_force_delete"])}"
target_group_arns = ["${compact(split(",", coalesce(lookup(var.worker_groups[count.index], "target_group_arns", ""), local.workers_group_defaults["target_group_arns"])))}"]
launch_configuration = "${element(aws_launch_configuration.workers.*.id, count.index)}"
vpc_zone_identifier = ["${split(",", coalesce(lookup(var.worker_groups[count.index], "subnets", ""), local.workers_group_defaults["subnets"]))}"]
@@ -22,6 +23,8 @@ resource "aws_autoscaling_group" "workers" {
}"]
lifecycle {
create_before_destroy = true
ignore_changes = ["desired_capacity"]
}
}