turbot/gcp_insights

Query: compute_disks_for_compute_instance

Usage

powerpipe query gcp_insights.query.compute_disks_for_compute_instance

SQL

with compute_instance as (
select
id,
disks
from
gcp_compute_instance
where
id = (split_part($1, '/', 1))::bigint
and project = split_part($1, '/', 2)
), compute_disk as (
select
self_link,
id,
project
from
gcp_compute_disk
)
select
d.id::text || '/' || d.project as disk_id
from
compute_instance i,
compute_disk d,
jsonb_array_elements(disks) as disk
where
d.self_link = (disk ->> 'source');