Commit 4e9187e7 authored by Chris Merrett's avatar Chris Merrett

Update workers.tf to add lifecycle controls to maintain uptime through launch configuration changes

parent 05dc78f2
Pipeline #5156 failed with stage
in 11 seconds
resource "aws_launch_configuration" "workers" { resource "aws_launch_configuration" "workers" {
lifecycle {
create_before_destroy = true
}
associate_public_ip_address = false associate_public_ip_address = false
ebs_optimized = "${var.ebs_optimized_workers}" ebs_optimized = "${var.ebs_optimized_workers}"
iam_instance_profile = "${aws_iam_instance_profile.workers.name}" iam_instance_profile = "${aws_iam_instance_profile.workers.name}"
image_id = "${data.aws_ami.eks_worker.id}" image_id = "${data.aws_ami.eks_worker.id}"
instance_type = "${var.instance_type}" instance_type = "${var.instance_type}"
name_prefix = "${var.cluster_name}-eks-workers" name_prefix = "${var.cluster_name}-eks-workers-"
security_groups = ["${aws_security_group.workers.id}"] security_groups = ["${aws_security_group.workers.id}"]
user_data_base64 = "${base64encode(data.template_file.workers_userdata.rendered)}" user_data_base64 = "${base64encode(data.template_file.workers_userdata.rendered)}"
...@@ -14,11 +18,15 @@ resource "aws_launch_configuration" "workers" { ...@@ -14,11 +18,15 @@ resource "aws_launch_configuration" "workers" {
} }
resource "aws_autoscaling_group" "workers" { resource "aws_autoscaling_group" "workers" {
lifecycle {
create_before_destroy = true
}
desired_capacity = "${var.desired_workers}" desired_capacity = "${var.desired_workers}"
launch_configuration = "${aws_launch_configuration.workers.id}" launch_configuration = "${aws_launch_configuration.workers.id}"
max_size = "${var.max_workers}" max_size = "${var.max_workers}"
min_size = "${var.min_workers}" min_size = "${var.min_workers}"
name = "${var.cluster_name}-eks-workers" name = "${var.cluster_name}-eks-workers - ${aws_launch_configuration.workers.name}"
vpc_zone_identifier = ["${var.private_subnets}"] vpc_zone_identifier = ["${var.private_subnets}"]
tag { tag {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment