Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix 20 accounts limit #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

fix 20 accounts limit #2

wants to merge 1 commit into from

Conversation

rusik69
Copy link

@rusik69 rusik69 commented Sep 19, 2022

fixing 20 accounts limit

by default list_accounts only returns some default amount of accounts

In my case i was able to get only reports for 20 accounts, adding pagination to lambda has fixed it

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@vdbrooks
Copy link

vdbrooks commented Jan 17, 2023

Your PR helped me quickly narrow down the issue, so thank you. There's a minor bug I ran into when implementing it though. The JSON in listed_accounts is slightly different after you added the orgClient paginator, and so the for loop in main needed to account for that.

Instead of:

for account in listedAccounts['Accounts']: if account['Status'] != 'SUSPENDED': assumeRole(account['Id'])

I had to replace it with:

for account in listedAccounts: if account['Status'] != 'SUSPENDED': assumeRole(account['Id']) return("Completed! Failed Accounts: ", failedAccounts)

As the accounts were no longer stored in a key called accounts. Outside of this, I'm a little surprised this fix hasn't been merged yet?

@reubensammut
Copy link

Thanks @rusik69 for the fix. Ideally should be added to the CloudFormation template as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants