You're facing an issue where Terraform hangs when trying to destroy the default VPC. This is a known behavior because AWS does not allow Terraform to delete the default VPC using the aws_default_vpc resource. This resource only manages default tags and settings—it doesn't delete the default VPC.
Why terraform destroy hangs on aws_default_vpc
The aws_default_vpc resource does not support deletion.
Even with force_destroy = true, this attribute is not valid for aws_default_vpc.
Terraform keeps trying because it assumes it can delete it—but AWS silently prevents it.
Recommended Solutions
1. Use the AWS CLI or Console to Delete It
You must manually delete the default VPC (if allowed) via AWS Console or AWS CLI:
aws ec2 delete-vpc --vpc-id vpc-0e1087cdb9242fc99
But note: AWS sometimes recreates default VPCs automatically, or doesn’t allow deletion in some regions.
2. Update Terraform Code to Stop Managing the Default VPC
Remove the block from your Terraform code entirely:
# Delete or comment out this block
# resource "aws_default_vpc" "default_vpc" {
# tags = {
# Name = "default-vpc"
# }
## }
Then run:
terraform apply
To detach from managing the default VPC
Alternative: Use Data Source Instead
If you need to reference the default VPC but not manage it, use:
data "aws_vpc" "default" {
default = true
}
Clean Way Forward
If your goal is a custom VPC setup, it’s best to:
Ignore the default VPC.
Use aws_vpc to create your own from scratch.
Use terraform state rm to remove aws_default_vpc.default_vpc from state if it’s stuck:
terraform state rm aws_default_vpc.default_vpc
Task Supported in Terraform? Workaround
Delete default VPC and Use AWS CLI/Console
Manage default VPC tagsUse aws_default_vpc
Prevent Terraform hanging (must remove) Remove block + state rm
Reference default VPC safely Use data "aws_vpc"