turbot/steampipe-mod-terraform-aws-compliance

Control: Amazon Redshift should have required maintenance settings

Description

Ensure whether Amazon Redshift clusters have the specified maintenance settings. Redshift clusters 'allowVersionUpgrade' should be set to 'true' and 'automatedSnapshotRetentionPeriod' should be greater than 7.

Usage

Run the control in your terminal:

powerpipe control run terraform_aws_compliance.control.redshift_cluster_maintenance_settings_check

Snapshot and share results via Turbot Pipes:

powerpipe login
powerpipe control run terraform_aws_compliance.control.redshift_cluster_maintenance_settings_check --share

SQL

This control uses a named query:

select
address as resource,
case
when (attributes_std -> 'allow_version_upgrade') is null and (attributes_std -> 'automated_snapshot_retention_period') is null then 'alarm'
when (attributes_std -> 'allow_version_upgrade') is null and (attributes_std -> 'automated_snapshot_retention_period')::integer >= 7 then 'ok'
when (attributes_std -> 'allow_version_upgrade')::bool and (attributes_std -> 'automated_snapshot_retention_period')::integer >= 7 then 'ok'
else 'alarm'
end status,
split_part(address, '.', 2) || case
when (attributes_std -> 'allow_version_upgrade') is null and (attributes_std -> 'automated_snapshot_retention_period') is null then ' does not have the required maintenance settings'
when (attributes_std -> 'allow_version_upgrade') is null and (attributes_std -> 'automated_snapshot_retention_period')::integer >= 7 then ' has the required maintenance settings'
when (attributes_std -> 'allow_version_upgrade')::bool and (attributes_std -> 'automated_snapshot_retention_period')::integer >= 7 then ' has the required maintenance settings'
else ' does not have the required maintenance settings'
end || '.' as reason
, path || ':' || start_line
from
terraform_resource
where
type = 'aws_redshift_cluster';

Tags