Table of Contents

The Error

When working with Terraform, you may encounter this error:

Error: VpcLimitExceeded: The maximum number of VPCs has been reached

This error can block your entire workflow. Let’s understand why it happens and how to fix it.

What Causes This Error

AWS accounts have a default limit of 5 VPCs per region. Creating another exceeds this quota.

How to Fix It

Solution 1

Request a VPC limit increase via AWS Service Quotas console.

Solution 2

Delete unused VPCs: check for empty VPCs with no resources attached.

Solution 3

Use a different AWS region if appropriate for your workload.

Solution 4

Consolidate workloads into fewer VPCs using multiple subnets instead.

Prevention Tips

  • Always run terraform validate before terraform plan
  • Use terraform fmt to keep configuration clean and readable
  • Pin provider versions to avoid unexpected schema changes
  • Review plan output carefully before applying

Learn More

Conclusion

This error is common but straightforward to fix. The key is understanding the root cause and applying the correct solution for your specific situation. Following the prevention tips above will help you avoid this error in future projects.