Control: Prevent a public IP from being assigned to a Cloud SQL instance
Usage
Run the control in your terminal:
powerpipe control run gcp_compliance.control.prevent_public_ip_cloudsql
Snapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe control run gcp_compliance.control.prevent_public_ip_cloudsql --share
SQL
This control uses a named query:
select self_link resource, case when ip_addresses @> '[{"type": "PRIMARY"}]' and backend_type = 'SECOND_GEN' then 'alarm' else 'ok' end as status, case when ip_addresses @> '[{"type": "PRIMARY"}]' and backend_type = 'SECOND_GEN' then title || ' associated with public IPs.' else title || ' not associated with public IPs.' end as reason , location as location, project as projectfrom gcp_sql_database_instance;