From c271a2fb3392fa162e66f5888a788476c8f17552 Mon Sep 17 00:00:00 2001 From: Vimal Paliwal Date: Tue, 20 May 2025 05:19:39 +0000 Subject: [PATCH 1/3] add support for new features --- main.tf | 9 +++++++++ variables.tf | 27 +++++++++++++++++++++++++-- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/main.tf b/main.tf index aa19da8..8638bd1 100644 --- a/main.tf +++ b/main.tf @@ -114,6 +114,15 @@ resource "aws_eks_node_group" "eks_ng" { labels = length(var.labels) == 0 ? null : var.labels + node_repair_config { + enabled = var.enable_node_auto_repair + } + + update_config { + max_unavailable = var.max_unavailable_type == "count" ? var.max_unavailable : null + max_unavailable_percentage = var.max_unavailable_type == "percentage" ? var.max_unavailable : null + } + # Ensure that IAM Role permissions are created before and deleted after EKS Node Group handling. # Otherwise, EKS will not be able to properly delete EC2 Instances and Elastic Network Interfaces. depends_on = [ diff --git a/variables.tf b/variables.tf index 574ed83..dbf1c64 100644 --- a/variables.tf +++ b/variables.tf @@ -83,8 +83,8 @@ variable "labels" { variable "ami_type" { type = string - default = "AL2_x86_64" - description = "Type of AMI to be used for EKS worker node. Supported values: AL2_x86_64, AL2_ARM_64, AL2_x86_64_GPU(AMI with GPU support)" + default = "AL2023_x86_64_STANDARD" + description = "Refer to [AWS doc](https://docs.aws.amazon.com/eks/latest/APIReference/API_Nodegroup.html#AmazonEKS-Type-Nodegroup-amiType) for supported AMI types" } variable "ami_release_version" { @@ -124,6 +124,29 @@ variable "force_update_version" { description = "Forcefully perform version update for worker nodes if pod disruption prevents node draining" } +variable "enable_node_auto_repair" { + type = bool + default = true + description = "Whether to enable node auto repair for the node group" +} + +variable "max_unavailable" { + type = number + default = 1 + description = "Maximum number/percentage of nodes that can be unavailable during the node group update" +} + +variable "max_unavailable_type" { + type = string + default = "count" + description = "Type of maximum unavailable nodes. **Valid values:** count or percentage" + + validation { + condition = var.max_unavailable_type == "count" || var.max_unavailable_type == "percentage" + error_message = "Invalid value for max_unavailable_type. Valid values: count or percentage" + } +} + variable "tags" { type = map(string) default = {} From e2c69e7b644a6e578d9a31ce8b720551135aeeca Mon Sep 17 00:00:00 2001 From: Vimal Paliwal Date: Tue, 20 May 2025 09:10:29 +0000 Subject: [PATCH 2/3] update default values for vars --- variables.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/variables.tf b/variables.tf index dbf1c64..477348d 100644 --- a/variables.tf +++ b/variables.tf @@ -65,13 +65,13 @@ variable "capacity_type" { variable "instance_types" { type = list(string) - default = ["t3.medium"] + default = null description = "List of type of instances to be used as EKS worker nodes" } variable "disk_size" { type = number - default = 20 + default = null description = "Size of each EBS volume attached to EKS worker node" } From 78918bfa730cec6e11d2c7b6666873f95638c843 Mon Sep 17 00:00:00 2001 From: Vimal Paliwal Date: Tue, 20 May 2025 09:34:13 +0000 Subject: [PATCH 3/3] update description for vars --- variables.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/variables.tf b/variables.tf index 477348d..054540e 100644 --- a/variables.tf +++ b/variables.tf @@ -66,13 +66,13 @@ variable "capacity_type" { variable "instance_types" { type = list(string) default = null - description = "List of type of instances to be used as EKS worker nodes" + description = "List of type of instances to be used as EKS worker nodes. **Note:** Not required when using `launch_template` variable" } variable "disk_size" { type = number default = null - description = "Size of each EBS volume attached to EKS worker node" + description = "Size of each EBS volume attached to EKS worker node. **Note:** Not required when using `launch_template` variable" } variable "labels" {