From ba68223e1a321f722c6e05a3ee746083931c25bf Mon Sep 17 00:00:00 2001 From: Gabriel Costa Date: Fri, 24 Nov 2023 12:33:25 -0800 Subject: [PATCH] Update cleanup config json --- scripts/cleanup_config.json | 20 ++++++++++++++++++++ scripts/cleanup_config.py | 1 - 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/scripts/cleanup_config.json b/scripts/cleanup_config.json index 6a468e6..2c5674a 100644 --- a/scripts/cleanup_config.json +++ b/scripts/cleanup_config.json @@ -150,6 +150,26 @@ "Type" : "IAM_ROLE", "Filter" : "sra-management-account-parameters-lambda" }, + { + "Type" : "IAM_ROLE", + "Filter" : "sra-helper-guardduty-lambda-role" + }, + { + "Type" : "IAM_ROLE", + "Filter" : "sra-guardduty-codebuild-role" + }, + { + "Type" : "IAM_ROLE", + "Filter" : "sra-guardduty-codebuild-lambda-role" + }, + { + "Type" : "IAM_ROLE", + "Filter" : "sra-helper-guardduty-codebuild-role" + }, + { + "Type" : "IAM_ROLE", + "Filter" : "sra-helper-guardduty-codebuild-lambda-role" + }, { "Type" : "STACK_SET", "Filter" : "sra-stackset-execution-role" diff --git a/scripts/cleanup_config.py b/scripts/cleanup_config.py index 7cbe70e..29becdb 100644 --- a/scripts/cleanup_config.py +++ b/scripts/cleanup_config.py @@ -468,7 +468,6 @@ def delete_iam_role(item): print(f"..Deleting inline policy {policy} from role {role_name}.") iam_session.delete_role_policy(RoleName=role_name, PolicyName=policy) print(f"....Deleting role {role_name}.") - iam_session iam_session.delete_role(RoleName=role_name) except Exception as exe: if exe.response['Error']['Code'] == 'NoSuchEntity':