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:
powerpipe control run gcp_thrifty.control.compute_disk_attached_stopped_instanceSnapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe control run gcp_thrifty.control.compute_disk_attached_stopped_instance --shareSteampipe 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.projectfrom  gcp_compute_disk as d  left join gcp_compute_instance as i on d.users ?& ARRAY [i.self_link];