terraform-aws-eks icon indicating copy to clipboard operation
terraform-aws-eks copied to clipboard

Cannot add managed node group with custom EKS ami image

Open alexeyinception opened this issue 6 months ago β€’ 8 comments

Description

It is not possible to add managed node group with custom ami to existing cluster. cluster version 'cluster_version = "1.31"' specified only under module "eks". there are no any 'version' specified.

  • [ X] βœ‹ I have searched the open/closed issues and my issue is not listed.

Versions

  • Module version [Required]: 20.36.0

  • Terraform version: Terraform v1.11.4 on linux_amd64

  • Provider version(s):

Reproduction Code [Required]

Here is a section of the code

    three = {
      name          = "amd-gpu-group"
      node_role_arn = aws_iam_role.eks_pod_identity_role.arn

      subnet_ids = ["${module.vpc.private_subnets[2]}", "${module.vpc.private_subnets[3]}"]

      update_config = {
        max_unavailable_percentage = 10
      }

      ami_type = "CUSTOM"

      use_custom_launch_template = true
      create_launch_template     = false
      launch_template_id = aws_launch_template.amd_gpu_custom_launch_template.id
      launch_template_version = "$Latest"

      labels = {
        node_groups = "amd-gpu-based"
      }

      min_size     = var.amd_gpu_group_min_size
      max_size     = var.amd_gpu_group_max_size
      desired_size = var.amd_gpu_group_desired_size

      tags = {
        k8s                                                         = "${local.cluster_prefix}"
        "k8s.io/cluster-autoscaler/enabled"                         = "true"
        "k8s.io/cluster-autoscaler/${module.eks.cluster_name}"      = "owned"
        "k8s.io/cluster-autoscaler/node-template/label/node_groups" = "amd-gpu-based"
      }

    } # end of group three 

'amd_gpu_custom_launch_template' exists

Steps to reproduce the behavior:

terraform apply

Expected behavior

new node group with custom ami should be created

Actual behavior

Error: creating EKS Node Group (icmps-dev-2-k8s:amd-gpu-group-20250515004336527100000001): operation error EKS: CreateNodegroup, https response error StatusCode: 400, RequestID: 77b23736-98a6-47d4-846d-3486e998c3b3, InvalidParameterException: You cannot specify a kubernetes version to use when specifying an image id to use within the launch template.
β”‚ 
β”‚   with module.eks.module.eks_managed_node_group["three"].aws_eks_node_group.this[0],
β”‚   on .terraform/modules/eks/modules/eks-managed-node-group/main.tf line 394, in resource "aws_eks_node_group" "this":
β”‚  394: resource "aws_eks_node_group" "this" {

Terminal Output Screenshot(s)

Additional context

refs

  • https://aws.amazon.com/blogs/containers/introducing-launch-template-and-custom-ami-support-in-amazon-eks-managed-node-groups/

alexeyinception avatar May 15 '25 00:05 alexeyinception