turbot/alicloud_insights

Query: ram_role_allows_cross_account_access_count

Usage

powerpipe query alicloud_insights.query.ram_role_allows_cross_account_access_count

Steampipe Tables

SQL

with roles_with_cross_account_access as (
select
distinct name as name
from
alicloud_ram_role,
jsonb_array_elements(assume_role_policy_document -> 'Statement') as stmt,
jsonb_array_elements_text(stmt -> 'Principal' -> 'RAM') as principal
where
split_part(principal, ':',4) <> account_id
)
select
count(name) as value,
'With Cross-Account Access' as label,
case when count(name) > 0 then 'alert' else 'ok' end as type
from
roles_with_cross_account_access;

Dashboards

The query is used in the dashboards: