turbot/alicloud_insights

Query: ecs_security_group_unassociated_count

Usage

powerpipe query alicloud_insights.query.ecs_security_group_unassociated_count

SQL

with associated_sg as (
select
group_id
from
alicloud_ecs_network_interface,
jsonb_array_elements_text(security_group_ids) as group_id
)
select
count(*) as value,
'Unassociated' as label,
case count(*) when 0 then 'ok' else 'alert' end as type
from
alicloud_ecs_security_group s
left join associated_sg a on s.security_group_id = a.group_id
where
a.group_id is null;

Dashboards

The query is used in the dashboards: