aws-samples / amazon-guardduty-multiaccount-scripts

This script automates the process of running the GuardDuty multi-account workflow across a group of accounts that are in your control
Apache License 2.0
130 stars 71 forks source link

Don't remove leading zeros from master account ID #8

Closed sthristov closed 6 years ago

sthristov commented 6 years ago

Issue #, if available: Hello,

Sorry for not starting a discussion but the change is quite small so here goes. I had a case where the master account ID started with a 0 (zero) and since the argument expected an int during the assignment the leading zero was removed and the account ID validation failed. EXAMPLE:

[amazon-guardduty-multiaccount-scripts] (master)$ python enableguardduty.py --master_account 012345678901 --assume_role DummyRoleName accounts.csv Traceback (most recent call last): File "enableguardduty.py", line 128, in raise ValueError("Master AccountId is not valid") ValueError: Master AccountId is not valid

After the change I was able to execute the script successfully.

Description of changes:

  1. I changed the argument to expect type string;
  2. Removed unnecessary cast to string in the regex validation since it's already a string.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.