Skip to content

GCP project is configured with legacy network

Description

In order to prevent use of legacy networks, a project should not have a legacy network configured.
Legacy networks have a single network IPv4 prefix range and a single gateway IP address for the whole network. The network is global in scope and spans all cloud regions. Subnetworks cannot be created in a legacy network and are unable to switch from legacy to auto or custom subnet networks. Legacy networks can have an impact for high network traffic projects and are subject to a single point of contention or failure.

Fix - Buildtime

Terraform

  • Resource: google_project
  • Argument: google_compute_network
resource "google_project" "bad_project" {
  name       = "My Project"
  project_id = "bad"
  org_id     = "1234567"
}

resource "google_compute_network" "vpc_network_bad" {
  name = "vpc-legacy"
- auto_create_subnetworks = true
  project = google_project.bad_project.id
}