Skip to content
This repository was archived by the owner on Sep 18, 2023. It is now read-only.
This repository was archived by the owner on Sep 18, 2023. It is now read-only.

Extend the group role map builder account alias function to accommodate other data producers #251

@gene1wood

Description

@gene1wood

Extend the group role map builder account alias function to accommodate other data producers by only updating records in the alias map instead of overwriting the map.

This will allow another tool that connects to AWS Organizations to fetch account ID and alias information to also run to get a more comprehensive alias map (including AWS Accounts that aren't using mozilla-aws-cli)

Modify this section

alias_map = {}
for assumed_role_arn in assumed_role_arns:
aws_account_id = assumed_role_arn.split(':')[4]
logger.debug('Fetching policies from {}'.format(aws_account_id))
client_sts = boto3.client('sts')
limiting_policy = {
'Version': '2012-10-17',
'Statement': [
{'Effect': 'Allow',
'Action': ['iam:ListRoles', 'iam:ListAccountAliases'],
'Resource': '*'}
],
}

so that it starts by fetching the existing map file and then updating it.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions