turbot/steampipe-mod-terraform-gcp-compliance

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_ip

Snapshot and share results via Turbot Pipes:

powerpipe login
powerpipe control run terraform_gcp_compliance.control.sql_instance_sql_with_no_public_ip --share

SQL

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_line
from
terraform_resource
where
type = 'google_sql_database_instance'
and (attributes_std ->> 'database_version') like 'SQLSERVER%';

Tags