turbot/alicloud_insights

Query: ram_policy_statement

Usage

powerpipe query alicloud_insights.query.ram_policy_statement

Steampipe Tables

SQL

with policy as (
select
distinct on (policy_name) *
from
alicloud_ram_policy
where
policy_name = $1
)
select
coalesce(t.stmt ->> 'Sid', concat('[', i :: text, ']')) as "Statement",
t.stmt ->> 'Effect' as "Effect",
action as "Action",
notaction as "NotAction",
resource as "Resource",
notresource as "NotResource",
t.stmt ->> 'Condition' as "Condition"
from
policy as p,
--alicloud_ram_policy as p,
jsonb_array_elements(p.policy_document_std -> 'Statement') with ordinality as t(stmt, i)
left join jsonb_array_elements_text(t.stmt -> 'Action') as action on true
left join jsonb_array_elements_text(t.stmt -> 'NotAction') as notaction on true
left join jsonb_array_elements_text(t.stmt -> 'Resource') as resource on true
left join jsonb_array_elements_text(t.stmt -> 'NotResource') as notresource on true

Dashboards

The query is used in the dashboards: