turbot/alicloud_thrifty

Control: Disks attached to stopped instances should be reviewed

Description

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

Usage

steampipe check alicloud_thrifty.control.ecs_disk_attached_stopped_instance

Plugins & Tables

SQL

select
d.arn as resource,
case
when d.instance_id is null then 'skip'
when i.status = 'Running' then 'ok'
else 'alarm'
end as status,
case
when d.instance_id is null then d.title || ' not attached to instance.'
when i.status = 'Running' then d.title || ' attached to running instance' || ' ' || d.instance_id || '.'
else d.title || ' attached to stopped instance' || ' ' || d.instance_id || '.'
end as reason,
d.region,
d.account_id
from
alicloud_ecs_disk as d
left join alicloud_ecs_instance as i on d.instance_id = i.instance_id;

Tags