How to fix Error: Error creating EKS Cluster: ResourceInUseException in Terraform

TerraformINTERMEDIATEHIGHUpdated Dec 30, 2025ยท 104 views

The ResourceInUseException error occurs when Terraform attempts to create an EKS cluster with a name that already exists in your AWS account, or when cluster resources are still being deleted. This prevents the cluster creation from proceeding until the conflicting resource is resolved.

Quick fix

Fixes Error: Error creating EKS Cluster: ResourceInUseException

aws eks list-clusters --region us-east-1
  1. Verify the cluster doesn't exist in AWS Console or AWS CLI
  2. Check Terraform state for stale resources
  3. Import existing cluster into Terraform state if needed
  4. Wait for previous deletion to complete
terraform โ€” error
aws eks list-clusters --region us-east-1
Error: Error creating EKS Cluster: ResourceInUseException

What this error means

AWS EKS has rejected the cluster creation request because a resource with the same name already exists in your account and region. This typically happens when: 1. A cluster with the same name exists but is in a deleting state 2. Previous Terraform runs created resources that weren't properly cleaned up 3. The cluster name conflicts with an existing cluster in your AWS account 4. Access entries or node groups with the same names already exist on the cluster AWS uses cluster names as unique identifiers within a region, so each cluster must have a unique name.

Typical symptoms

  • Terraform apply fails with 'ResourceInUseException: Cluster already exists with name [name]'
  • Error occurs even though you deleted the cluster recently
  • Creation fails on the first apply attempt with a new configuration
  • The error happens immediately without waiting for resource creation

Common causes

  1. A cluster with the same name already exists in the same AWS region (most common)
  2. A previous cluster is still being deleted and hasn't fully cleaned up yet
  3. Orphaned AWS resources from a failed previous cluster creation attempt
  4. Terraform state is out of sync with actual AWS resources
  5. Access entries or node groups created manually conflict with Terraform-managed resources

How to fix "Error: Error creating EKS Cluster: ResourceInUseException"

1Verify the cluster doesn't exist in AWS Console or AWS CLI

First, check if a cluster with the same name actually exists in your AWS account:

bash
aws eks list-clusters --region us-east-1

Replace us-east-1 with your target region. If your cluster name appears in the list, the cluster exists. Check the cluster status - if it shows "DELETING", you must wait until it completes deletion (typically 15-30 minutes) before trying to create a new cluster with the same name.

2Check Terraform state for stale resources

Verify your Terraform state hasn't diverged from actual AWS resources:

bash
terraform refresh
terraform plan

This will sync your local state with AWS and show what Terraform thinks should exist. If the plan shows the cluster being created but it actually exists in AWS, your state is out of sync.

3Import existing cluster into Terraform state if needed

If the cluster exists in AWS but not in your Terraform state, import it:

bash
terraform import aws_eks_cluster.main my-cluster-name

Replace aws_eks_cluster.main with your actual resource address and my-cluster-name with your cluster name. This adds the existing AWS resource to your Terraform state, preventing duplicate creation attempts.

4Wait for previous deletion to complete

If you recently deleted a cluster, AWS needs time to fully clean up all associated resources (security groups, networking, IAM roles). Wait 15-30 minutes after deletion completes before attempting to create a new cluster with the same name:

bash
aws eks describe-cluster --name my-cluster-name --region us-east-1

If this returns an error that the cluster doesn't exist, it's safe to create a new one with that name.

5Use a unique cluster name as a temporary workaround

If you need to proceed immediately, modify your Terraform configuration to use a different cluster name:

hcl
resource "aws_eks_cluster" "main" {
  name            = "my-cluster-new-v2"  # Changed from my-cluster
  role_arn        = aws_iam_role.cluster.arn
  vpc_config {
    subnet_ids = var.subnet_ids
  }
}

After the problematic resources are fully cleaned up, you can rename it back to your original name.

6Clean up orphaned CloudFormation stacks (if applicable)

Check AWS CloudFormation for any stuck stacks related to EKS:

bash
aws cloudformation list-stacks --stack-status-filter CREATE_FAILED DELETE_FAILED

Look for any stacks with names matching your cluster. If found, attempt deletion:

bash
aws cloudformation delete-stack --stack-name problematic-stack-name

If the stack refuses to delete, you may need to delete associated resources manually (security groups, network interfaces, IAM roles) first.

Advanced notes

EKS Access Entry Conflicts: When upgrading terraform-aws-eks module versions (e.g., 19.20 to 20.5), migration from ConfigMap-based access to IAM access entries can trigger ResourceInUseException if access entries are partially created. Manually delete conflicting access entries from the cluster first:

bash
aws eks delete-access-entry --cluster-name my-cluster --principal-arn arn:aws:iam::ACCOUNT:role/ROLE_NAME

State Lock Issues: If you're using Terraform with a remote state backend (S3 + DynamoDB), ensure no other team member has a lock on the state:

bash
terraform force-unlock LOCK_ID

Region-Specific Names: Remember that cluster names only need to be unique within a region. You can have clusters with the same name in different regions if needed.

Node Group Conflicts: Similar ResourceInUseException errors can occur with managed node groups. If the error mentions 'NodeGroup already exists', follow the same troubleshooting steps but using aws eks delete-nodegroup --cluster-name NAME --nodegroup-name NAME to clean up.

Frequently asked questions

What does "Error: Error creating EKS Cluster: ResourceInUseException" mean?
AWS EKS has rejected the cluster creation request because a resource with the same name already exists in your account and region. This typically happens when: 1. A cluster with the same name exists but is in a deleting state 2.
How do I fix "Error: Error creating EKS Cluster: ResourceInUseException"?
The ResourceInUseException error occurs when Terraform attempts to create an EKS cluster with a name that already exists in your AWS account, or when cluster resources are still being deleted. This prevents the cluster creation from proceeding until the conflicting resource is resolved.
What causes "Error: Error creating EKS Cluster: ResourceInUseException"?
A cluster with the same name already exists in the same AWS region (most common) A previous cluster is still being deleted and hasn't fully cleaned up yet Orphaned AWS resources from a failed previous cluster creation attempt
Is the "Error: Error creating EKS Cluster: ResourceInUseException" error serious?
Yes. This is a high-severity error that usually blocks work until it is fixed, but the steps above resolve it.

Official resources & further reading