Skip to content

Commit 3f1d91d

Browse files
committed
ensuring rule delete operations don't target accounts not in rule_accounts (e.g. mgmt acct)
1 parent a5c627e commit 3f1d91d

File tree

1 file changed

+3
-0
lines changed
  • aws_sra_examples/solutions/genai/bedrock_org/lambda/src

1 file changed

+3
-0
lines changed

aws_sra_examples/solutions/genai/bedrock_org/lambda/src/app.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -819,6 +819,9 @@ def deploy_config_rules(region: str, accounts: list, resource_properties: dict)
819819

820820
if rule_deploy is False:
821821
LOGGER.info(f"{rule_name} is not to be deployed. Checking to see if it needs to be removed...")
822+
if acct not in rule_accounts:
823+
LOGGER.info(f"{rule_name} does not apply to {acct}; skipping attempt to delete...")
824+
continue
822825
delete_custom_config_rule(rule_name, acct, region)
823826
delete_custom_config_iam_role(rule_name, acct)
824827
continue

0 commit comments

Comments
 (0)