Control: GCP SQL instance should not have public IP address
Description
This control checks whether the GCP SQL instance has a public IP address.
Usage
Run the control in your terminal:
powerpipe control run terraform_gcp_compliance.control.sql_instance_sql_with_no_public_ipSnapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe control run terraform_gcp_compliance.control.sql_instance_sql_with_no_public_ip --shareSQL
This control uses a named query:
select  address as resource,  case    when (attributes_std -> 'settings' -> 'ip_configuration' ->> 'ipv4_enabled') is null then 'alarm'    when (attributes_std -> 'settings' -> 'ip_configuration' ->> 'ipv4_enabled')::boolean then 'alarm'    else 'ok'  end as status,  split_part(address, '.', 2) || case    when (attributes_std -> 'settings' -> 'ip_configuration' ->> 'ipv4_enabled') is null then ' ipv4_enabled is not defined'    when (attributes_std -> 'settings' -> 'ip_configuration' ->> 'ipv4_enabled')::boolean then ' public IP address configured'    else ' no public IP address configured'  end || '.' reason  , path || ':' || start_linefrom  terraform_resourcewhere  type = 'google_sql_database_instance'  and (attributes_std ->> 'database_version') like 'SQLSERVER%';