Add support for ASG max instance lifetime (#769)

Co-authored-by: Thierno IB. BARRY <ibrahima.br@gmail.com>
This commit is contained in:
Siddarth Prakash
2020-03-09 18:31:52 -04:00
committed by GitHub
parent 6784824595
commit 198294c0b6
4 changed files with 12 additions and 0 deletions

View File

@@ -12,6 +12,7 @@ project adheres to [Semantic Versioning](http://semver.org/).
- Fix doc about spot instances, cluster-autoscaler should be scheduled on normal instances instead of spot (by @simowaer)
- 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)
# History

View File

@@ -79,6 +79,7 @@ locals {
spot_allocation_strategy = "lowest-price" # Valid options are 'lowest-price' and 'capacity-optimized'. If 'lowest-price', the Auto Scaling group launches instances using the Spot pools with the lowest price, and evenly allocates your instances across the number of Spot pools. If 'capacity-optimized', the Auto Scaling group launches instances using Spot pools that are optimally chosen based on the available Spot capacity.
spot_instance_pools = 10 # "Number of Spot pools per availability zone to allocate capacity. EC2 Auto Scaling selects the cheapest Spot pools and evenly allocates Spot capacity across the number of Spot pools that you specify."
spot_max_price = "" # Maximum price per unit hour that the user is willing to pay for the Spot instances. Default is the on-demand price
max_instance_lifetime = 0 # Maximum number of seconds instances can run in the ASG. 0 is unlimited.
}
workers_group_defaults = merge(

View File

@@ -73,6 +73,11 @@ resource "aws_autoscaling_group" "workers" {
"termination_policies",
local.workers_group_defaults["termination_policies"]
)
max_instance_lifetime = lookup(
var.worker_groups_launch_template[count.index],
"max_instance_lifetime",
local.workers_group_defaults["max_instance_lifetime"],
)
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"]) : []

View File

@@ -72,6 +72,11 @@ resource "aws_autoscaling_group" "workers_launch_template" {
"termination_policies",
local.workers_group_defaults["termination_policies"]
)
max_instance_lifetime = lookup(
var.worker_groups_launch_template[count.index],
"max_instance_lifetime",
local.workers_group_defaults["max_instance_lifetime"],
)
dynamic mixed_instances_policy {
iterator = item