turbot/terraform_azure_compliance

Query: cognitive_account_encrypted_with_cmk

Usage

powerpipe query terraform_azure_compliance.query.cognitive_account_encrypted_with_cmk

Steampipe Tables

SQL

with all_cognitive_account as (
select
*
from
terraform_resource
where
type = 'azurerm_cognitive_account'
),
cognitive_account_cmk as (
select
*
from
terraform_resource
where
type = 'azurerm_cognitive_account_customer_managed_key'
)
select
c.address as resource,
case
when (b.attributes_std ->> 'cognitive_account_id') is not null then 'ok'
else 'alarm'
end as status,
split_part(c.address, '.', 2) || case
when (b.attributes_std ->> 'cognitive_account_id') is not null then ' encrypted with CMK'
else ' not encrypted with CMK'
end || '.' reason,
c.path || ':' || c.start_line
from
all_cognitive_account as c
left join cognitive_account_cmk as b on c.name = (
split_part(
(b.attributes_std ->> 'cognitive_account_id'),
'.',
2
)
)

Controls

The query is being used by the following controls: