Skip to content

Terraform apply fails after importing EKS cluster with Auto Mode disabled #3236

Closed
@cw-juyeonyu

Description

@cw-juyeonyu

Description

Please provide a clear and concise description of the issue you are encountering, and a reproduction of your configuration (see the examples/* directory for references that you can copy+paste and tailor to match your configs if you are unable to copy your exact configuration). The reproduction MUST be executable by running terraform init && terraform apply without any further changes.

If your request is for a new feature, please use the Feature request template.

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

⚠️ Note

Before you submit an issue, please perform the following first:

  1. Remove the local .terraform directory (! ONLY if state is stored remotely, which hopefully you are following that best practice!): rm -rf .terraform/
  2. Re-initialize the project root to pull down modules: terraform init
  3. Re-attempt your terraform plan or apply and check if the issue still persists

Versions

  • Module version [Required]:

  • Terraform version:
    1.10.1

  • Provider version(s):
    20.31.1

Reproduction Code [Required]

module "eks" {
source = "terraform-aws-modules/eks/aws"
version = "20.31.1"

cluster_name = "dev-cluster"
cluster_version = "1.31"

cluster_compute_config = {
enabled = false
}

.......
}

Steps to reproduce the behavior:

  1. Enable EKS Auto Mode using AWS CLI:
aws eks update-cluster-config --name dev-cluster \
    --compute-config enabled=true \
    --kubernetes-network-config '{"elasticLoadBalancer":{"enabled": true}}' \
    --storage-config '{"blockStorage":{"enabled": true}}'
  1. Disable EKS Auto Mode using AWS CLI:
aws eks update-cluster-config --name dev-cluster \
    --compute-config enabled=false \
    --kubernetes-network-config '{"elasticLoadBalancer":{"enabled": false}}' \
    --storage-config '{"blockStorage":{"enabled": false}}'
  1. Import Terraform state for EKS cluster:
terraform import "module.eks.aws_eks_cluster.this[0]" dev-cluster
  1. Run Terraform Plan & Apply
# plan
~ resource "aws_eks_cluster" "this" {
        id                            = "dev-cluster"
        name                          = "dev-cluster"
        # (12 unchanged attributes hidden)
      - storage_config {
          - block_storage {
              - enabled = false -> null
            }
        }
        # (7 unchanged blocks hidden)
    }
Plan: 0 to add, 1 to change, 0 to destroy.

# error message
Error: updating EKS Cluster (dev-cluster) compute config: operation error EKS: UpdateClusterConfig, https response error StatusCode: 400, RequestID: xxxxxxx, InvalidParameterException: The type for cluster update was not provided.

Expected behavior

Prevent Terraform apply from failing when EKS Auto Mode is disabled.

Actual behavior

Terminal Output Screenshot(s)

Additional context

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions