turbot/terraform_azure_compliance

Query: sql_database_long_term_geo_redundant_backup_enabled

Usage

powerpipe query terraform_azure_compliance.query.sql_database_long_term_geo_redundant_backup_enabled

Steampipe Tables

SQL

select
address as resource,
case
when (attributes_std -> 'long_term_retention_policy') is null then 'alarm'
when (
attributes_std -> 'long_term_retention_policy' ->> 'monthly_retention'
) :: text <> 'PT0S'
or (
attributes_std -> 'long_term_retention_policy' ->> 'weekly_retention'
) :: text <> 'PT0S'
or (
attributes_std -> 'long_term_retention_policy' ->> 'yearly_retention'
) :: text <> 'PT0S' then 'ok'
else 'alarm'
end status,
split_part(address, '.', 2) || case
when (attributes_std -> 'long_term_retention_policy') is null then ' ''long_term_retention_policy'' is not set'
when (
attributes_std -> 'long_term_retention_policy' ->> 'monthly_retention'
) :: text <> 'PT0S'
or (
attributes_std -> 'long_term_retention_policy' ->> 'weekly_retention'
) :: text <> 'PT0S'
or (
attributes_std -> 'long_term_retention_policy' ->> 'yearly_retention'
) :: text <> 'PT0S' then ' long-term geo-redundant backup enabled'
else ' long-term geo-redundant backup disabled'
end || '.' reason,
path || ':' || start_line
from
terraform_resource
where
type = 'azurerm_mssql_database';

Controls

The query is being used by the following controls: