Control: Check if Cloud SQL instances are world readable
Usage
Run the control in your terminal:
powerpipe control run gcp_compliance.control.sql_world_readableSnapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe control run gcp_compliance.control.sql_world_readable --shareSQL
This control uses a named query:
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 projectfrom  gcp_sql_database_instance;