Skip to content

Conversation

@sbkok
Copy link
Collaborator

@sbkok sbkok commented Jan 12, 2023

Why?

While running the adf-build/main.py script:

  1. It would get the list of accounts of this specific AWS Organization.
  2. Spin up a thread for any of the non-deployment accounts.
  3. In the thread, check if the account is in the root or in a protected OU. If so, it would stop the thread. If not, it would deploy the bootstrap templates. So far so good.
  4. When invoking the Step Function to enable the cross-account access, it would use the list of account ids it retrieved before. However, this list is unfiltered.

Therefore, the Step Function State Machine would try to enable the cross account access on accounts that were in the root and/or in protected organization units.

What?

We would only need to bootstrap accounts that are:

  • Active,
  • Not in the AWS Organization root, and
  • Not in an AWS Organization OU that is listed as protected.

ADF should also fix the cross-account access in those accounts only. As the others don't have a bootstrap template deployed that needs to be updated any way.

Thus, instead of introducing the same logic in the Step Function. This change set moved the responsibility for filtering the accounts based on their state and location in the Organizations class.

Tests were added to validate that this works correctly.

Additionally, fixes were introduced to reduce the line lengths where needed.


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

**Why?**

While running the `adf-build/main.py` script:
1. It would get the list of accounts of this specific AWS Organization.
2. Spin up a thread for any of the non-deployment accounts.
3. In the thread, check if the account is in the root or in a protected OU. If
   so, it would stop the thread. If not, it would deploy the bootstrap
   templates. So far so good.
4. When invoking the Step Function to enable the cross-account access, it would
   use the list of account ids it retrieved before. However, this list is
   unfiltered.

Therefore, the Step Function State Machine would try to enable
the cross account access on accounts that were in the root and/or in
protected organization units.

**What?**

We would only need to bootstrap accounts that are:
* Active,
* Not in the AWS Organization root, and
* Not in an AWS Organization OU that is listed as protected.

ADF should also fix the cross-account access in those accounts only.
As the others don't have a bootstrap template deployed that needs to be updated
any way.

Thus, instead of introducing the same logic in the Step Function. This change
set moved the responsibility for filtering the accounts based on their state
and location in the Organizations class.

Tests were added to validate that this works correctly.

Additionally, fixes were introduced to reduce the line lengths where needed.
@sbkok sbkok added this to the v3.2.0 milestone Jan 12, 2023
@sbkok sbkok added the bug Something isn't working label Jan 12, 2023
@sbkok sbkok merged commit 3ae94ba into awslabs:master Jan 18, 2023
@sbkok sbkok deleted the fix/bootstrap-to-non-protected-ous-only branch January 18, 2023 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants