From b3c5b3796ecb07fecd65f2beaa884093cd747611 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20=C5=A0usta?= Date: Mon, 15 Jul 2024 21:57:24 +0200 Subject: [PATCH] AWS: don't process the management account twice There's already a block for processing the management account. The Organizations call for listing accounts will however list also the top-level "root" account. They however don't have the OrganizationAccountAccessRole set up. --- aws/aws-resource-counter.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/aws/aws-resource-counter.py b/aws/aws-resource-counter.py index 6adf163..8d4fb0d 100644 --- a/aws/aws-resource-counter.py +++ b/aws/aws-resource-counter.py @@ -416,6 +416,8 @@ def count_resources(input_type, management_access_key, management_secret_key): for account in page['Accounts']: member_account_ids.append(account['Id']) + member_account_ids.remove(management_account_id) + # Loop through each member account for member_account_id in tqdm(member_account_ids, desc="Processing Member Accounts"): # Create a new session for each member account by assuming the role