turbot/gcp_compliance

Query: sql_instance_not_publicly_accessible

Usage

powerpipe query gcp_compliance.query.sql_instance_not_publicly_accessible

SQL

select
self_link as resource,
case
when (ip_addresses @> '[{"type": "PRIVATE"}]' and ip_configuration ->> 'privateNetwork' is not null) and not (ip_addresses @> '[{"type": "PRIMARY"}]') then 'ok'
else 'alarm'
end as status,
case
when (ip_addresses @> '[{"type": "PRIVATE"}]' and ip_configuration ->> 'privateNetwork' is not null) and not (ip_addresses @> '[{"type": "PRIMARY"}]') then title || ' not publicly accessible.'
else title || ' publicly accessible.'
end as reason
, location as location, project as project
from
gcp_sql_database_instance;

Controls

The query is being used by the following controls: