mirror of
https://github.com/ysoftdevs/terraform-aws-eks.git
synced 2026-03-11 21:11:32 +01:00
Add option to enable lifecycle hooks creation (#532)
* add option to enable lifecycle hooks creation * update changelog
This commit is contained in:
committed by
GitHub
parent
27e6e3d7a9
commit
186c88a34b
@@ -15,7 +15,7 @@ project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
### Changed
|
||||
|
||||
- Write your awesome change here (by @you)
|
||||
- Add option to enable lifecycle hooks creation (by @barryib)
|
||||
|
||||
# History
|
||||
|
||||
|
||||
@@ -142,6 +142,7 @@ MIT Licensed. See [LICENSE](https://github.com/terraform-aws-modules/terraform-a
|
||||
| worker\_additional\_security\_group\_ids | A list of additional security group ids to attach to worker instances | list(string) | `[]` | no |
|
||||
| worker\_ami\_name\_filter | Additional name filter for AWS EKS worker AMI. Default behaviour will get latest for the cluster_version but could be set to a release from amazon-eks-ami, e.g. "v20190220" | string | `"v*"` | no |
|
||||
| worker\_ami\_name\_filter\_prefix | Name prefix filter for AWS EKS worker AMI. Default behaviour will get regular EKS-Optimized AMI but could be set to a EKS-Optimized AMI with GPU Support, e.g. "amazon-eks-gpu-node", or custom AMI | string | `"amazon-eks-node"` | no |
|
||||
| worker\_create\_initial\_lifecycle\_hooks | Whether to create initial lifecycle hooks provided in worker groups. | bool | `"false"` | no |
|
||||
| worker\_create\_security\_group | Whether to create a security group for the workers or attach the workers to `worker_security_group_id`. | bool | `"true"` | no |
|
||||
| worker\_groups | A list of maps defining worker group configurations to be defined using AWS Launch Configurations. See workers_group_defaults for valid keys. | any | `[]` | no |
|
||||
| worker\_groups\_launch\_template | A list of maps defining worker group configurations to be defined using AWS Launch Templates. See workers_group_defaults for valid keys. | any | `[]` | no |
|
||||
|
||||
@@ -210,6 +210,12 @@ variable "worker_create_security_group" {
|
||||
default = true
|
||||
}
|
||||
|
||||
variable "worker_create_initial_lifecycle_hooks" {
|
||||
description = "Whether to create initial lifecycle hooks provided in worker groups."
|
||||
type = bool
|
||||
default = false
|
||||
}
|
||||
|
||||
variable "permissions_boundary" {
|
||||
description = "If provided, all IAM roles will be created with this permissions boundary attached."
|
||||
type = string
|
||||
|
||||
@@ -75,10 +75,10 @@ resource "aws_autoscaling_group" "workers" {
|
||||
)
|
||||
|
||||
dynamic "initial_lifecycle_hook" {
|
||||
for_each = lookup(var.worker_groups[count.index], "asg_initial_lifecycle_hooks", local.workers_group_defaults["asg_initial_lifecycle_hooks"])
|
||||
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"]) : []
|
||||
content {
|
||||
name = lookup(initial_lifecycle_hook.value, "name", null)
|
||||
lifecycle_transition = lookup(initial_lifecycle_hook.value, "lifecycle_transition", null)
|
||||
name = initial_lifecycle_hook.value["name"]
|
||||
lifecycle_transition = initial_lifecycle_hook.value["lifecycle_transition"]
|
||||
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)
|
||||
|
||||
@@ -151,10 +151,10 @@ 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"])
|
||||
for_each = var.worker_create_initial_lifecycle_hooks ? 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)
|
||||
name = initial_lifecycle_hook.value["name"]
|
||||
lifecycle_transition = initial_lifecycle_hook.value["lifecycle_transition"]
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user