turbot/gcp_insights

Query: compute_network_subnet_count

Usage

powerpipe query gcp_insights.query.compute_network_subnet_count

SQL

with compute_subnetwork as (
select
network_name,
project
from
gcp_compute_subnetwork
), compute_network as (
select
name,
project,
id
from
gcp_compute_network
where
id = (split_part($1, '/', 1))::bigint
and project = split_part($1, '/', 2)
)
select
'Subnets' as label,
count(*) as value,
case when count(*) > 0 then 'ok' else 'alert' end as type
from
compute_subnetwork s,
compute_network n
where
s.network_name = n.name
and s.project = n.project;

Dashboards

The query is used in the dashboards: