Table of Contents
The Error
Error creating DynamoDB Table: ResourceInUseException: Table already exists
What Causes This
A DynamoDB table with the same name already exists in the same region. DynamoDB table names must be unique per region per account. This also occurs if the table is being created/deleted concurrently.
How to Fix It
Solution 1: Import the Existing Table
terraform import aws_dynamodb_table.users my-users-table
Solution 2: Check Table Status
# The table might be in a transitional state
aws dynamodb describe-table --table-name my-table \
--query 'Table.TableStatus'
# CREATING, UPDATING, DELETING — wait for it to finish
# ACTIVE — table exists, import or rename
Solution 3: Use Unique Names
resource "aws_dynamodb_table" "users" {
name = "${var.project}-${var.environment}-users"
billing_mode = "PAY_PER_REQUEST"
hash_key = "UserId"
attribute {
name = "UserId"
type = "S"
}
}
Solution 4: Wait for Deletion
# If a previous destroy is still in progress
aws dynamodb wait table-not-exists --table-name my-table
terraform apply
Prevention Tips
- Pin provider versions — avoid surprise breaking changes
- Use CI/CD — catch errors before they hit production
- Test with
terraform plan— always review before applying - Keep Terraform updated — newer versions have better error messages
- Use
terraform validate— catches syntax errors early
Hands-On Courses
Learn to avoid these errors with interactive, project-based courses:
- Terraform for Beginners on CopyPasteLearn
- Terraform By Example — practical code examples
- Terraform Cheat Sheet — quick reference for all commands
Related Articles
- Terraform Troubleshooting - Common Errors and Solutions
- Terraform Enabling and Using Debugging
- Debugging with TFLint
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.

