turbot/gcp_insights

Query: compute_disks_for_kms_key

Usage

powerpipe query gcp_insights.query.compute_disks_for_kms_key

SQL

select
d.id::text as disk_id
from
gcp_compute_disk d,
gcp_kms_key_version k
where
d.disk_encryption_key is not null
and split_part(d.disk_encryption_key ->> 'kmsKeyName', '/cryptoKeyVersions/', 2) = k.crypto_key_version::text
and split_part(d.disk_encryption_key ->> 'kmsKeyName', '/', 8) = k.key_name
and $1 like '%' || split_part(d.disk_encryption_key ->> 'kmsKeyName', '/cryptoKeyVersions/', 1);