From c8cc60f46d2e164964d88edfbaa62b2ad85eee26 Mon Sep 17 00:00:00 2001 From: Bruno Meneguello Date: Tue, 9 Oct 2018 05:52:12 -0300 Subject: [PATCH] Add suspended_processes attributes to autoscaling_group (#153) --- CHANGELOG.md | 1 + local.tf | 1 + workers.tf | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 53e24e4..698fe48 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ project adheres to [Semantic Versioning](http://semver.org/). - A useful addition (slam dunk, @self 🔥) - Worker groups can be created with a specified IAM profile. (from @laverya) - exposed `aws_eks_cluster` create and destroy timeouts (by @RGPosadas) +- Added `suspended_processes` to `worker_groups` input (by @bkmeneguello) - exposed `placement_tenancy` for autoscaling group (by @monsterxx03) - Allow port 443 from EKS service to nodes to run `metrics-server`. (by @max-rocket-internet) diff --git a/local.tf b/local.tf index 89b0d4f..feda20b 100644 --- a/local.tf +++ b/local.tf @@ -33,6 +33,7 @@ locals { additional_security_group_ids = "" # A comman delimited list of additional security group ids to include in worker launch config protect_from_scale_in = false # Prevent AWS from scaling in, so that cluster-autoscaler is solely responsible. iam_role_id = "${local.default_iam_role_id}" # Use the specified IAM role if set. + suspended_processes = "" # A comma delimited string of processes to to suspend. i.e. AZRebalance,HealthCheck,ReplaceUnhealthy } workers_group_defaults = "${merge(local.workers_group_defaults_defaults, var.workers_group_defaults)}" diff --git a/workers.tf b/workers.tf index 9ea7ed4..68d4254 100644 --- a/workers.tf +++ b/workers.tf @@ -6,13 +6,14 @@ resource "aws_autoscaling_group" "workers" { 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"]))}"] protect_from_scale_in = "${lookup(var.worker_groups[count.index], "protect_from_scale_in", local.workers_group_defaults["protect_from_scale_in"])}" + suspended_processes = ["${split(",", coalesce(lookup(var.worker_groups[count.index], "suspended_processes", ""), local.workers_group_defaults["suspended_processes"]))}"] count = "${var.worker_group_count}" tags = ["${concat( list( map("key", "Name", "value", "${aws_eks_cluster.this.name}-${lookup(var.worker_groups[count.index], "name", count.index)}-eks_asg", "propagate_at_launch", true), map("key", "kubernetes.io/cluster/${aws_eks_cluster.this.name}", "value", "owned", "propagate_at_launch", true), - map("key", "k8s.io/cluster-autoscaler/${lookup(var.worker_groups[count.index], "autoscaling_enabled", local.workers_group_defaults["autoscaling_enabled"]) == 1 ? "enabled" : "disabled" }", "value", "true", "propagate_at_launch", false), + map("key", "k8s.io/cluster-autoscaler/${lookup(var.worker_groups[count.index], "autoscaling_enabled", local.workers_group_defaults["autoscaling_enabled"]) == 1 ? "enabled" : "disabled" }", "value", "true", "propagate_at_launch", false) ), local.asg_tags) }"]