turbot/steampipe-mod-terraform-gcp-compliance

Control: Ensure that Cloud SQL database instances are configured with automated backups

Description

It is recommended to have all SQL database instances set to enable automated backups.

Usage

Run the control in your terminal:

powerpipe control run terraform_gcp_compliance.control.sql_instance_automated_backups_enabled

Snapshot and share results via Turbot Pipes:

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

SQL

This control uses a named query:

select
address as resource,
case
when (attributes_std -> 'settings' -> 'backup_configuration' ->> 'enabled')::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' -> 'backup_configuration') is null then ' ''settings.backup_configuration'' is not defined'
when (attributes_std -> 'settings' -> 'backup_configuration' ->> 'enabled') is null
then ' ''settings.backup_configuration.enabled'' is not defined'
when (attributes_std -> 'settings' -> 'backup_configuration' ->> 'enabled')::boolean then ' automatic backups configured'
else ' automatic backups not configured'
end || '.' reason
, path || ':' || start_line
from
terraform_resource
where
type = 'google_sql_database_instance';

Tags