Skip to main content

Upgrading the Kubernetes Version

To upgrade the Kubernetes version of your EKS cluster, update the kubernetes_version variable in your module definition (renamed from cluster_version in v21.x):
module "eks" {
  source  = "terraform-aws-modules/eks/aws"
  version = "~> 21.0"

  name               = "my-cluster"
  kubernetes_version = "1.32" # bump this value

  # ...
}
Then run:
terraform plan   # review the proposed changes
terraform apply  # apply the version upgrade
EKS upgrades are performed one minor version at a time. Attempting to skip a minor version will result in an API error. For example, to go from 1.29 to 1.31, you must first upgrade to 1.30.

Upgrading the Module Version

1

Review the upgrade guide

Read the breaking changes section below for the target major version before making any changes.
2

Update the version constraint

Change the version argument in your module source block to the new target.
3

Reinitialise Terraform

terraform init -upgrade
4

Apply incremental state moves (if required)

Some major versions require Terraform state moves before applying. These are documented in the per-version sections below.
5

Plan and apply

terraform plan
terraform apply

Breaking Changes by Major Version

Upgrade from v16.x to v17.x

This release removes the use of random_pet resources in Managed Node Groups (MNG). Those resources were used to force MNG re-creation on changes but caused many issues. Without intervention, upgrading will cause your MNGs to be replaced.

Migration Steps

1

Apply v16.2.0 first

Before upgrading, ensure your configuration is fully applied at v16.2.0.
2

Retrieve existing node group names

terraform state show 'module.eks.module.node_groups.aws_eks_node_group.workers["example"]' | grep node_group_name
# node_group_name = "test-eks-mwIwsvui-example-sincere-squid"
3

Pin existing names in your configuration

Set the current node group name explicitly to prevent re-creation:
module "eks" {
  source  = "terraform-aws-modules/eks/aws"
  version = "17.0.0"

  cluster_name    = "test-eks-mwIwsvui"
  cluster_version = "1.20"

  node_groups = {
    example = {
      name = "test-eks-mwIwsvui-example-sincere-squid"
      # ...
    }
  }
}
4

Plan and verify

Run terraform plan. You should see only the random_pet resource scheduled for destruction — no node group replacements:
# Plan: 0 to add, 0 to change, 1 to destroy.
# Only: module.eks.module.node_groups.random_pet.node_groups["example"] will be destroyed
5

Apply

terraform apply
After the first apply, remove the hardcoded name argument and let the module use node_group_name_prefix to generate names automatically. This avoids collisions during node group re-creation since lifecycle { create_before_destroy = true } is set.

Build docs developers (and LLMs) love