turbot/gcp_thrifty
GitHub
Loading controls...

Control: Disks attached to stopped instances should be reviewed

Description

Instances that are stopped may no longer need any disks attached.

Usage

Run the control in your terminal:

steampipe check gcp_thrifty.control.compute_disk_attached_stopped_instance

Snapshot and share results via Steampipe Cloud:

steampipe login
steampipe check --share gcp_thrifty.control.compute_disk_attached_stopped_instance

Plugins & Tables

SQL

select
d.self_link as resource,
case
when d.users is null then 'skip'
when i.status = 'RUNNING' then 'ok'
else 'info'
end as status,
case
when d.users is null then d.name || ' not attached to instance.'
when i.status = 'RUNNING' then d.name || ' attached to running instance.'
else d.name || ' not attached to running instance.'
end as reason,
d.location,
d.project
from
gcp_compute_disk as d
left join gcp_compute_instance as i on d.users ? & ARRAY [ i.self_link ];

Tags