Description
To prevent a default VPC from being created in a new project, apply the compute.skipDefaultNetworkCreation organization policy.
Potential impact
The default network and its firewall rules may allow traffic the project does not need.
Remediation
Define the VPCs and firewall rules your workloads need. Check dependencies before removing an existing default network.
Examples
Supply a unique project_id and your org_id. With true, Terraform retains the default network if organization policy permits its creation.
Before
hcl
resource "google_project" "project" {
name = "My Project"
project_id = "your-project-id"
org_id = "1234567"
auto_create_network = true
}
After
hcl
resource "google_project" "project" {
name = "My Project"
project_id = "your-project-id"
org_id = "1234567"
auto_create_network = false
}
With false, Terraform deletes the default network after creation. This approach requires one available network quota slot and leaves the Compute Engine API enabled.