Skip to main content
Fix Terraform Error - Timeout While Waiting for State

Fix Terraform Error - Timeout While Waiting for State

Key Takeaway

How to fix 'timeout while waiting for state to become' errors in Terraform for slow resource provisioning (RDS, EKS, CloudFront).

Table of Contents

The Error

Error: timeout while waiting for state to become 'available'

What Causes This

The resource took longer to provision than Terraform’s default timeout. Some resources like RDS instances, EKS clusters, CloudFront distributions, and large EC2 instances can take 10-30+ minutes to become available.

How to Fix It

Solution 1: Increase Timeouts

resource "aws_db_instance" "main" {
  identifier     = "production-db"
  engine         = "postgres"
  instance_class = "db.r5.xlarge"
  allocated_storage = 100

  timeouts {
    create = "60m"   # Default is usually 40m
    update = "80m"
    delete = "40m"
  }
}

resource "aws_eks_cluster" "main" {
  name     = "production"
  role_arn = aws_iam_role.eks.arn

  timeouts {
    create = "30m"
    update = "60m"
    delete = "15m"
  }
}

Solution 2: Check Resource Health

# Maybe the resource is failing, not just slow
aws rds describe-db-instances --db-instance-identifier production-db \
  --query 'DBInstances[0].DBInstanceStatus'

aws eks describe-cluster --name production \
  --query 'cluster.status'

Solution 3: Apply Again

# If it timed out but the resource is still creating:
# Wait for it to finish, then import or refresh
terraform refresh
terraform plan

Prevention Tips

  1. Pin provider versions — avoid surprise breaking changes
  2. Use CI/CD — catch errors before they hit production
  3. Test with terraform plan — always review before applying
  4. Keep Terraform updated — newer versions have better error messages
  5. Use terraform validate — catches syntax errors early

Hands-On Courses

Learn to avoid these errors with interactive, project-based courses:

Conclusion

This error is common and fixable. Follow the solutions above, and check our Terraform course for hands-on training that covers real-world troubleshooting scenarios.

🚀

Level Up Your Terraform Skills

Hands-on courses, books, and resources from Luca Berton

Luca Berton
Written by

Luca Berton

DevOps Engineer, AWS Partner, Terraform expert, and author. Creator of Ansible Pilot, Terraform Pilot, and CopyPasteLearn.