mirror of
https://github.com/ysoftdevs/terraform-aws-eks.git
synced 2026-03-12 05:21:33 +01:00
Add support for ASG max instance lifetime (#769)
Co-authored-by: Thierno IB. BARRY <ibrahima.br@gmail.com>
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
1
local.tf
1
local.tf
@@ -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(
|
||||
|
||||
@@ -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"]) : []
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user