mirror of
https://github.com/ysoftdevs/terraform-aws-eks.git
synced 2026-01-17 17:22:13 +01:00
add initial lifecycle hooks for autosacling groups (#466)
This commit is contained in:
committed by
Max Williams
parent
d8ed7d0b66
commit
d6d0975452
@@ -16,6 +16,7 @@ project adheres to [Semantic Versioning](http://semver.org/).
|
||||
- Added support for workers iam role tag in `./workers.tf` (@lucas-giaco)
|
||||
- Added `required_providers` to enforce provider minimum versions (by @dpiddockcmp)
|
||||
- Updated `local.spot_allocation_strategy` docstring to indicate availability of new `capacity-optimized` option. (by @sc250024)
|
||||
- Added support for initial lifecycle hooks for autosacling groups (@barryib)
|
||||
- Added option to recreate ASG when LT or LC changes (by @barryib)
|
||||
|
||||
### Changed
|
||||
|
||||
1
local.tf
1
local.tf
@@ -21,6 +21,7 @@ locals {
|
||||
asg_max_size = "3" # Maximum worker capacity in the autoscaling group.
|
||||
asg_min_size = "1" # Minimum worker capacity in the autoscaling group.
|
||||
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 LT or LC change.
|
||||
instance_type = "m4.large" # Size of the workers instances.
|
||||
spot_price = "" # Cost of spot instance.
|
||||
|
||||
13
workers.tf
13
workers.tf
@@ -74,6 +74,19 @@ resource "aws_autoscaling_group" "workers" {
|
||||
local.workers_group_defaults["termination_policies"]
|
||||
)
|
||||
|
||||
dynamic "initial_lifecycle_hook" {
|
||||
for_each = lookup(var.worker_groups[count.index], "asg_initial_lifecycle_hooks", local.workers_group_defaults["asg_initial_lifecycle_hooks"])
|
||||
content {
|
||||
name = lookup(initial_lifecycle_hook.value, "name", null)
|
||||
lifecycle_transition = lookup(initial_lifecycle_hook.value, "lifecycle_transition", null)
|
||||
notification_metadata = lookup(initial_lifecycle_hook.value, "notification_metadata", null)
|
||||
heartbeat_timeout = lookup(initial_lifecycle_hook.value, "heartbeat_timeout", null)
|
||||
notification_target_arn = lookup(initial_lifecycle_hook.value, "notification_target_arn", null)
|
||||
role_arn = lookup(initial_lifecycle_hook.value, "role_arn", null)
|
||||
default_result = lookup(initial_lifecycle_hook.value, "default_result", null)
|
||||
}
|
||||
}
|
||||
|
||||
tags = concat(
|
||||
[
|
||||
{
|
||||
|
||||
@@ -82,6 +82,19 @@ resource "aws_autoscaling_group" "workers_launch_template" {
|
||||
)
|
||||
}
|
||||
|
||||
dynamic "initial_lifecycle_hook" {
|
||||
for_each = lookup(var.worker_groups_launch_template[count.index], "asg_initial_lifecycle_hooks", local.workers_group_defaults["asg_initial_lifecycle_hooks"])
|
||||
content {
|
||||
name = lookup(initial_lifecycle_hook.value, "name", null)
|
||||
lifecycle_transition = lookup(initial_lifecycle_hook.value, "lifecycle_transition", null)
|
||||
notification_metadata = lookup(initial_lifecycle_hook.value, "notification_metadata", null)
|
||||
heartbeat_timeout = lookup(initial_lifecycle_hook.value, "heartbeat_timeout", null)
|
||||
notification_target_arn = lookup(initial_lifecycle_hook.value, "notification_target_arn", null)
|
||||
role_arn = lookup(initial_lifecycle_hook.value, "role_arn", null)
|
||||
default_result = lookup(initial_lifecycle_hook.value, "default_result", null)
|
||||
}
|
||||
}
|
||||
|
||||
tags = concat(
|
||||
[
|
||||
{
|
||||
|
||||
@@ -133,6 +133,19 @@ resource "aws_autoscaling_group" "workers_launch_template_mixed" {
|
||||
}
|
||||
}
|
||||
|
||||
dynamic "initial_lifecycle_hook" {
|
||||
for_each = lookup(var.worker_groups_launch_template_mixed[count.index], "asg_initial_lifecycle_hooks", local.workers_group_defaults["asg_initial_lifecycle_hooks"])
|
||||
content {
|
||||
name = lookup(initial_lifecycle_hook.value, "name", null)
|
||||
default_result = lookup(initial_lifecycle_hook.value, "default_result", null)
|
||||
heartbeat_timeout = lookup(initial_lifecycle_hook.value, "heartbeat_timeout", null)
|
||||
lifecycle_transition = lookup(initial_lifecycle_hook.value, "lifecycle_transition", null)
|
||||
notification_metadata = lookup(initial_lifecycle_hook.value, "notification_metadata", null)
|
||||
notification_target_arn = lookup(initial_lifecycle_hook.value, "notification_target_arn", null)
|
||||
role_arn = lookup(initial_lifecycle_hook.value, "role_arn", null)
|
||||
}
|
||||
}
|
||||
|
||||
tags = concat(
|
||||
[
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user