Table: gcp_compute_networks

This table shows data for GCP Compute Networks.

The primary key for this table is self_link.

Columns

NameType
_cq_iduuid
_cq_parent_iduuid
project_idutf8
ipv4_rangeutf8
auto_create_subnetworksbool
creation_timestamputf8
descriptionutf8
enable_ula_internal_ipv6bool
firewall_policyutf8
gateway_ipv4utf8
idint64
internal_ipv6_rangeutf8
kindutf8
mtuint64
nameutf8
network_firewall_policy_enforcement_orderutf8
peeringsjson
routing_configjson
self_link (PK)utf8
self_link_with_idutf8
subnetworkslist<item: utf8, nullable>

Example Queries

These SQL queries are sampled from CloudQuery policies and are compatible with PostgreSQL.

Ensure that the default network does not exist in a project (Automated)

SELECT
  name AS resource_id,
  'Ensure that the default network does not exist in a project (Automated)'
    AS title,
  project_id AS project_id,
  CASE WHEN name = 'default' THEN 'fail' ELSE 'pass' END AS status
FROM
  gcp_compute_networks;

Ensure that VPC Flow Logs is enabled for every subnet in a VPC Network (Automated)

SELECT
  DISTINCT
  gcn.name AS resource_id,
  'Ensure that VPC Flow Logs is enabled for every subnet in a VPC Network (Automated)'
    AS title,
  gcn.project_id AS project_id,
  CASE WHEN gcs.enable_flow_logs = false THEN 'fail' ELSE 'pass' END AS status
FROM
  gcp_compute_networks AS gcn
  JOIN gcp_compute_subnetworks AS gcs ON gcn.self_link = gcs.network;

Ensure that Cloud DNS logging is enabled for all VPC networks (Automated)

SELECT
  DISTINCT
  gcn.name AS resource_id,
  'Ensure that Cloud DNS logging is enabled for all VPC networks (Automated)'
    AS title,
  gcn.project_id AS project_id,
  CASE WHEN gdp.enable_logging = false THEN 'fail' ELSE 'pass' END AS status
FROM
  gcp_dns_policies AS gdp,
  jsonb_array_elements(gdp.networks) AS gdpn
  JOIN gcp_compute_networks AS gcn ON
      gcn.self_link
      = replace(gdpn->>'networkUrl', 'compute.googleapis', 'www.googleapis');