turbot/aws_insights

Query: iam_all_policies_for_group

Usage

powerpipe query aws_insights.query.iam_all_policies_for_group

Steampipe Tables

SQL

-- Policies (attached to groups)
select
split_part(policy_arn, '/','2') as "Policy",
policy_arn as "ARN",
'Attached to Group' as "Via"
from
aws_iam_group as g,
jsonb_array_elements_text(g.attached_policy_arns) as policy_arn
where
g.arn = $1
and g.account_id = split_part($1, ':', 5)
-- Policies (inline from groups)
union select
i ->> 'PolicyName' as "Policy",
'N/A' as "ARN",
'Inline' as "Via"
from
aws_iam_group as grp,
jsonb_array_elements(grp.inline_policies_std) as i
where
arn = $1
and account_id = split_part($1, ':', 5);

Dashboards

The query is used in the dashboards: