turbot/steampipe-mod-terraform-azure-compliance

Control: Azure Cosmos DB accounts should have firewall rules

Description

Firewall rules should be defined on your Azure Cosmos DB accounts to prevent traffic from unauthorized sources. Accounts that have at least one IP rule defined with the virtual network filter enabled are deemed compliant. Accounts disabling public access are also deemed compliant.

Usage

Run the control in your terminal:

powerpipe control run terraform_azure_compliance.control.cosmosdb_account_with_firewall_rules

Snapshot and share results via Turbot Pipes:

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

SQL

This control uses a named query:

select
address as resource,
case
when (attributes_std ->> 'public_network_access_enabled')::boolean
and (attributes_std ->> 'is_virtual_network_filter_enabled' )::boolean = 'false'
and (attributes_std ->> 'ip_range_filter') is null then 'alarm'
else 'ok'
end status,
split_part(address, '.', 2) || case
when (attributes_std ->> 'public_network_access_enabled')::boolean
and (attributes_std ->> 'is_virtual_network_filter_enabled' )::boolean = 'false'
and (attributes_std ->> 'ip_range_filter') is null then ' not have firewall rules'
else ' have firewall rules'
end || '.' reason
, path || ':' || start_line
from
terraform_resource
where
type = 'azurerm_cosmosdb_account';

Tags