turbot/steampipe-mod-terraform-gcp-compliance

Control: Ensure that all BigQuery Tables are encrypted with Customer-managed encryption key (CMEK)

Description

BigQuery by default encrypts the data as rest by employing Envelope Encryption using Google managed cryptographic keys. The data is encrypted using the data encryption keys and data encryption keys themselves are further encrypted using key encryption keys. This is seamless and does not require any additional input from the user. However, if you want to have greater control, Customer-managed encryption keys (CMEK) can be used as encryption key management solution for BigQuery tables. If CMEK is used, the CMEK is used to encrypt the data encryption keys instead of using google-managed encryption keys.

Usage

Run the control in your terminal:

powerpipe control run terraform_gcp_compliance.control.bigquery_table_encrypted_with_cmk

Snapshot and share results via Turbot Pipes:

powerpipe login
powerpipe control run terraform_gcp_compliance.control.bigquery_table_encrypted_with_cmk --share

SQL

This control uses a named query:

select
address as resource,
case
when (attributes_std -> 'encryption_configuration') is null then 'alarm'
else 'ok'
end as status,
split_part(address, '.', 2) || case
when (attributes_std -> 'encryption_configuration') is null then ' not encrypted with customer-managed encryption keys'
else ' encrypted with customer-managed encryption keys'
end || '.' reason
, path || ':' || start_line
from
terraform_resource
where
type = 'google_bigquery_table';

Tags