Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
35 changes: 29 additions & 6 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ variable "capacity_type" {

variable "instance_types" {
type = list(string)
default = ["t3.medium"]
description = "List of type of instances to be used as EKS worker nodes"
default = null
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 = 20
description = "Size of each EBS volume attached to EKS worker node"
default = null
description = "Size of each EBS volume attached to EKS worker node. **Note:** Not required when using `launch_template` variable"
}

variable "labels" {
Expand All @@ -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" {
Expand Down Expand Up @@ -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 = {}
Expand Down