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_rulesSnapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe control run terraform_azure_compliance.control.cosmosdb_account_with_firewall_rules --shareSQL
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_linefrom  terraform_resourcewhere  type = 'azurerm_cosmosdb_account';