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.
Code Example
go
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
}Remediation
Terraform
- Resource: google_project
- Arguments: google_compute_network
Rule Details
| Field | Value |
|---|---|
| ID | IAC-0987 |
| Severity | MEDIUM |
| IaC Type | Terraform |
| Frameworks | Terraform, TerraformPlan |
| Checkov ID | CKV2_GCP_2 |