Description
An Ansible task that omits users does not show whether an IAM group is empty. Check the current members and the group’s purpose.
Potential impact
An empty group grants nobody access today, but users added later can inherit its existing policies.
Remediation
Check the owner and attached policies before adding anyone. Include every member you need to keep if you enable purge_users. Review policies and dependencies before deleting an unused group.
Examples
The short module name iam_group requires Ansible to resolve amazon.aws.iam_group.
Before
- name: Create an IAM group
iam_group:
name: testgroup1
state: present
The first task leaves membership of testgroup1 unspecified.
After
- name: Create an IAM group
iam_group:
name: testgroup2
managed_policy:
- arn:aws:iam::aws:policy/AmazonSNSFullAccess
users:
- test_user1
- test_user2
state: present
The second adds two users to a different group, testgroup2. Check whether both need AmazonSNSFullAccess.