Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ASG cooldown and health_check_grace_period #770

Merged
merged 3 commits into from
Mar 10, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ project adheres to [Semantic Versioning](http://semver.org/).
- Adding `encrypted` option to worker's root_block_device as read from the worker configurations (by @craig-rueda)
- Use correct policy arns for CN regions (cn-north-1, cn-northwest-1) (by @cofyc)
- Add support for ASG max instance lifetime (by @sidprak)
- Add `default_cooldown` option to workers ASG (by @ArieLevs)
- Add `health_check_grace_period` option to workers ASG (by @ArieLevs)
ArieLevs marked this conversation as resolved.
Show resolved Hide resolved

# History

Expand Down
2 changes: 2 additions & 0 deletions local.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ locals {
asg_force_delete = false # Enable forced deletion for the autoscaling group.
asg_initial_lifecycle_hooks = [] # Initital lifecycle hook for the autoscaling group.
asg_recreate_on_change = false # Recreate the autoscaling group when the Launch Template or Launch Configuration change.
default_cooldown = null # The amount of time, in seconds, after a scaling activity completes before another scaling activity can start.
health_check_grace_period = null # Time in seconds after instance comes into service before checking health.
instance_type = "m4.large" # Size of the workers instances.
spot_price = "" # Cost of spot instance.
placement_tenancy = "" # The tenancy of the instance. Valid values are "default" or "dedicated".
Expand Down
10 changes: 10 additions & 0 deletions workers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,16 @@ resource "aws_autoscaling_group" "workers" {
"max_instance_lifetime",
local.workers_group_defaults["max_instance_lifetime"],
)
default_cooldown = lookup(
var.worker_groups[count.index],
"default_cooldown",
local.workers_group_defaults["default_cooldown"]
)
health_check_grace_period = lookup(
var.worker_groups[count.index],
"health_check_grace_period",
local.workers_group_defaults["health_check_grace_period"]
)

dynamic "initial_lifecycle_hook" {
for_each = var.worker_create_initial_lifecycle_hooks ? lookup(var.worker_groups[count.index], "asg_initial_lifecycle_hooks", local.workers_group_defaults["asg_initial_lifecycle_hooks"]) : []
Expand Down
10 changes: 10 additions & 0 deletions workers_launch_template.tf
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,16 @@ resource "aws_autoscaling_group" "workers_launch_template" {
"max_instance_lifetime",
local.workers_group_defaults["max_instance_lifetime"],
)
default_cooldown = lookup(
var.worker_groups_launch_template[count.index],
"default_cooldown",
local.workers_group_defaults["default_cooldown"]
)
health_check_grace_period = lookup(
var.worker_groups_launch_template[count.index],
"health_check_grace_period",
local.workers_group_defaults["health_check_grace_period"]
)

dynamic mixed_instances_policy {
iterator = item
Expand Down