turbot/steampipe-mod-terraform-gcp-compliance

Control: Ensure that the Cloud SQL database instance requires all incoming connections to use SSL

Description

It is recommended to enforce all incoming connections to SQL database instance to use SSL.

Usage

Run the control in your terminal:

powerpipe control run terraform_gcp_compliance.control.sql_instance_require_ssl_enabled

Snapshot and share results via Turbot Pipes:

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

SQL

This control uses a named query:

select
address as resource,
case
when (attributes_std -> 'settings' -> 'ip_configuration' ->> 'require_ssl')::boolean then 'ok' else 'alarm'
end as status,
split_part(address, '.', 2) || case
when (attributes_std -> 'settings') is null then ' ''settings'' is not defined'
when (attributes_std -> 'settings' -> 'ip_configuration') is null then ' ''settings.ip_configuration'' is not defined'
when (attributes_std -> 'settings' -> 'ip_configuration' ->> 'require_ssl') is null
then ' ''settings.ip_configuration.require_ssl'' is not defined'
when (attributes_std -> 'settings' -> 'ip_configuration' ->> 'require_ssl')::boolean then ' enforces SSL connections'
else ' does not enforce SSL connections'
end || '.' reason
, path || ':' || start_line
from
terraform_resource
where
type = 'google_sql_database_instance';

Tags