awslabs / aws-securityhub-multiaccount-scripts

This script automates the process of running the Security Hub multi-account workflow across a group of accounts that are in your control
MIT No Attribution
271 stars 108 forks source link

Exception handling for optional regions #56

Open pacohope opened 3 years ago

pacohope commented 3 years ago

I added a few extra exception handlers that wrap around calls to the Config service. If the region is an optional region, and the account hasn't opted into it, then this catches the exception and writes a failure note explaining why. There was also a missing continue near the if not config_result which explains why failed accounts caused problems and weren't handled gracefully the way they were meant to.

Strictly speaking, the unhandled exceptions are being thrown on line 121, but I catch them farther down because it lets me create a nice error message.

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