turbot/gcp_insights

Query: compute_instance_with_public_ip_address_count

Usage

powerpipe query gcp_insights.query.compute_instance_with_public_ip_address_count

Steampipe Tables

SQL

with instance_with_access_config as (
select
name
from
gcp_compute_instance,
jsonb_array_elements(network_interfaces) nic,
jsonb_array_elements(nic -> 'accessConfigs') d
where
d ->> 'natIP' is not null
)
select
count(*) as value,
'Publicly Accessible' as label,
case
count(*)
when 0 then 'ok'
else 'alert'
end as "type"
from
instance_with_access_config;

Dashboards

The query is used in the dashboards: