The VpcLimitExceeded error occurs when your AWS account has reached the maximum number of VPCs allowed per region (default: 5). Resolve this by deleting unused VPCs or requesting a quota increase from AWS Service Quotas.
AWS enforces resource quotas to manage infrastructure capacity and costs. When you attempt to create a VPC using Terraform and this error appears, it means your AWS account has already reached the maximum number of VPCs allocated for that region. By default, AWS allows 5 VPCs per region per account. This is an account-level limit, not a Terraform issue. The AWS provider is correctly rejected the request because it violates your account's service quota. This can happen when you're testing infrastructure, managing multiple environments, or working across multiple projects.
First, verify how many VPCs you currently have in the region where Terraform is trying to create a new one:
1. Log in to the AWS Management Console
2. Navigate to VPC > Your VPCs
3. Ensure you're viewing the correct region (check the region selector in the top-right)
4. Count the number of VPCs displayed
This confirms whether you're hitting the limit. Note that AWS always creates one "default" VPC per region that counts toward your quota.
If you have test, development, or unused VPCs, delete them to free up quota:
1. In the AWS Console, go to VPC > Your VPCs
2. For each VPC you want to remove:
- Select the VPC
- Click "Actions" > "Delete VPC"
- Confirm deletion (all dependencies like subnets and route tables will be removed)
3. Wait a few moments for the deletion to complete
4. Run terraform apply again
Important: Only delete VPCs you're certain you no longer need. Deleting the wrong VPC can cause outages.
If you need more than 5 VPCs in a region, request a quota increase from AWS:
1. Open the AWS Service Quotas console: https://console.aws.amazon.com/servicequotas
2. Search for "VPC" in the service list
3. Click "Amazon Virtual Private Cloud (Amazon VPC)" (NOT "Amazon EC2")
4. Find the quota named "VPCs per Region"
5. Click on the quota and select "Request quota increase"
6. Enter your desired VPC count (you can request up to hundreds)
7. Click "Request quota increase" and wait for AWS approval
AWS typically approves quota increase requests within a few business days. You'll receive email confirmation once approved.
After approval, re-run terraform apply:
terraform plan
terraform applyOnce you've freed up quota space or received approval for an increase:
# Refresh Terraform state to check for any stale references
terraform refresh
# Plan the infrastructure to verify no other issues exist
terraform plan
# Apply the configuration to create your VPC
terraform applyIf the error persists after quota increase approval, ensure:
- You're applying in the correct AWS region
- Your AWS credentials have the necessary VPC permissions
- There are no other dependent resources blocking VPC creation
Related AWS quotas: Requesting a VPC quota increase also increases the Internet Gateway per Region quota by the same amount, since each VPC typically needs at least one IGW. If you're also hitting "InternetGatewayLimitExceeded" errors, the VPC quota increase will resolve that too.
Regional quotas: These quotas are per-region, not per-account. You can have 5 VPCs in us-east-1, 5 in eu-west-1, etc. separately. If you're deploying across multiple regions, you'll need to request increases in each region where needed.
Default VPC: AWS creates one "default" VPC per region automatically. This counts toward your quota. If you don't need the default VPC, you can delete it to reclaim quota space for custom VPCs.
Terraform workspace best practice: When managing multiple environments, use a single VPC with multiple subnets and security groups instead of creating separate VPCs. This is more efficient and avoids quota limits.
Error: Error installing helm release: cannot re-use a name that is still in use
How to fix "release name in use" error in Terraform with Helm
Error: Error creating GKE Cluster: BadRequest
BadRequest error creating GKE cluster in Terraform
Error: External program failed to produce valid JSON
External program failed to produce valid JSON
Error: Unsupported argument in child module call
How to fix "Unsupported argument in child module call" in Terraform
Error: network is unreachable
How to fix "network is unreachable" in Terraform