Table of Contents

The Error

Error creating Route: RouteAlreadyExists: The route identified by 0.0.0.0/0 already exists

What Causes This

A route with the same destination CIDR already exists in the route table. This commonly happens when the route was created manually, by another Terraform resource, or when the VPC’s default route conflicts.

How to Fix It

Solution 1: Import the Existing Route

terraform import aws_route.internet rtb-0123456789abcdef0_0.0.0.0/0

Solution 2: Use Inline Routes vs Separate Resources

# Option A: Inline routes (manages ALL routes in the table)
resource "aws_route_table" "public" {
  vpc_id = aws_vpc.main.id
  route {
    cidr_block = "0.0.0.0/0"
    gateway_id = aws_internet_gateway.main.id
  }
}

# Option B: Separate route resources (recommended for complex setups)
resource "aws_route_table" "public" {
  vpc_id = aws_vpc.main.id
  # No inline routes!
}

resource "aws_route" "internet" {
  route_table_id         = aws_route_table.public.id
  destination_cidr_block = "0.0.0.0/0"
  gateway_id             = aws_internet_gateway.main.id
}

⚠️ Don’t mix inline and separate routes for the same route table!

Solution 3: Check for Duplicate Definitions

grep -rn 'destination_cidr_block.*0.0.0.0/0' *.tf
# Make sure only one route defines 0.0.0.0/0 per route table

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.