turbot/steampipe-mod-terraform-azure-compliance

Control: Container registries should be zone redundant

Description

This control ensures that Container registry is zone redundant.

Usage

Run the control in your terminal:

powerpipe control run terraform_azure_compliance.control.container_registry_zone_redundant_enabled

Snapshot and share results via Turbot Pipes:

powerpipe login
powerpipe control run terraform_azure_compliance.control.container_registry_zone_redundant_enabled --share

SQL

This control uses a named query:

with geo_replication_zone_redundant as (
select
distinct name
from
terraform_resource
where
type = 'azurerm_container_registry'
and
(not (attributes_std -> 'georeplications' -> 'zone_redundancy_enabled')::bool
or attributes_std -> 'georeplications' -> 'zone_redundancy_enabled' is null)
)
select
address as resource,
case
when (r.attributes_std -> 'georeplications') is null then 'alarm'
when not (attributes_std -> 'zone_redundancy_enabled')::boolean then 'alarm'
when g.name is not null then 'alarm'
else 'ok'
end status,
split_part(address, '.', 2) || case
when (r.attributes_std -> 'georeplications') is null then ' geo replication not defined'
when not (attributes_std -> 'zone_redundancy_enabled')::boolean then ' not zone redundant'
when g.name is not null then ' not zone redundant'
else ' zone redundant'
end || '.' reason
, path || ':' || start_line
from
terraform_resource as r
left join geo_replication_zone_redundant as g on g.name = r.name
where
type = 'azurerm_container_registry';

Tags