turbot/gcp_compliance

Query: sql_instance_not_open_to_internet

Usage

powerpipe query gcp_compliance.query.sql_instance_not_open_to_internet

SQL

select
self_link as resource,
case
when exists (
select 1
from jsonb_array_elements(ip_configuration -> 'authorizedNetworks') as authNet
where authNet ->> 'value' = '0.0.0.0/0' or authNet ->> 'value' = '::/0'
) then 'alarm'
else 'ok'
end as status,
case
when exists (
select 1
from jsonb_array_elements(ip_configuration -> 'authorizedNetworks') as authNet
where authNet ->> 'value' = '0.0.0.0/0' or authNet ->> 'value' = '::/0'
) then title || ' is open to the internet.'
else title || ' is not open to the internet.'
end as reason
, location as location, project as project
from
gcp_sql_database_instance;

Controls

The query is being used by the following controls: