Skip to content

EKS Module v21 - EFA Network Interfaces Type MismatchΒ #3481

@bkruger99

Description

@bkruger99

Description

When setting enable_efa_support = true on any EKS node group (managed or self-managed), terraform plan fails with a type mismatch error. The module's internal logic tries to conditionally assign different object types that are incompatible.

  • I have searched the open/closed issues and my issue is not listed.

Versions

  • Module version: 21.0.9
  • Terraform version: 1.12.1
  • Provider version(s): aws 6.9.0

Reproduction Code

terraform {
  required_version = ">= 1.0"
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 6.0"
    }
  }
}

provider "aws" {
  region = "us-east-1"
}

data "aws_availability_zones" "available" {}

module "vpc" {
  source  = "terraform-aws-modules/vpc/aws"
  version = "~> 5.0"

  name = "efa-test-vpc"
  cidr = "10.0.0.0/16"

  azs             = slice(data.aws_availability_zones.available.names, 0, 3)
  private_subnets = ["10.0.1.0/24", "10.0.2.0/24", "10.0.3.0/24"]
  public_subnets  = ["10.0.101.0/24", "10.0.102.0/24", "10.0.103.0/24"]

  enable_nat_gateway = true
  enable_vpn_gateway = false

  tags = {
    Terraform = "true"
    Environment = "test"
  }
}

module "eks" {
  source  = "terraform-aws-modules/eks/aws"
  version = "~> 21.0"

  name               = "efa-test-cluster"
  kubernetes_version = "1.33"

  vpc_id                  = module.vpc.vpc_id
  subnet_ids              = module.vpc.private_subnets
  endpoint_public_access  = true

  eks_managed_node_groups = {
    efa_test = {
      min_size       = 0
      max_size       = 1
      desired_size   = 0
      instance_types = ["p5.48xlarge"]

      enable_efa_support = true
      enable_efa_only    = true
      efa_indices        = [0, 4, 8, 12]
      subnet_ids = module.vpc.private_subnets
    }
  }

  tags = {
    Terraform = "true"
    Environment = "test"
  }
}

Steps to reproduce:

  1. Save the above configuration to main.tf
  2. Run terraform init
  3. Run terraform plan

Expected behavior

Terraform plan should succeed and show resources to be created.

Actual behavior

Terraform plan fails with type mismatch error.

Terminal Output

Error: Inconsistent conditional result types

  on .terraform/modules/eks/modules/eks-managed-node-group/main.tf line 68, in locals:
  68:   network_interfaces = local.enable_efa_support ? local.efa_network_interfaces : var.network_interfaces

    β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
    β”‚ local.efa_network_interfaces is tuple with 32 elements
    β”‚ local.enable_efa_support is true
    β”‚ var.network_interfaces is empty list of object

The true and false result expressions must have consistent types. The 'true' value is tuple, but the 'false' value is list of object.

Additional context

v20.36.0 and earlier: EFA works correctly

v21.0.0 and later: EFA broken with type mismatch error (tested v21.0.0 as well and yeah, broken there too)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions