Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Macie support - CORE-387 #459

Merged
merged 18 commits into from May 9, 2023
Merged

Update Macie support - CORE-387 #459

merged 18 commits into from May 9, 2023

Conversation

arsci
Copy link
Contributor

@arsci arsci commented May 5, 2023

Description

Closes CORE-387

Updated ability to nuke Macie resources

Macie itself is simply enabled/disabled for each region, however each instance must be cleared of Member Account links and administrator account links.

Added support for the use of time filter, but does not support the use of configObj regex filtering

Additional testing was done manually with multiple AWS accounts to ensure the proper functionality of the member disassociation/deletion and administrator deletion.

TODOs

Read the Gruntwork contribution guidelines.

  • Update the docs.
  • Run the relevant tests successfully, including pre-commit checks.
  • Ensure any 3rd party code adheres with our license policy or delete this line if its not applicable.
  • Include release notes. If this PR is backward incompatible, include a migration guide.
  • Attention Grunts - if this PR adds support for a new resource, ensure the nuke_sandbox and nuke_phxdevops jobs in .circleci/config.yml have been updated with appropriate exclusions (either directly in the job or via the .circleci/nuke_config.yml file) to prevent nuking IAM roles, groups, resources, etc that are important for the test accounts.

Release Notes

Updated Macie nuke support

@arsci arsci changed the title Update Macie support - CORE-387 [WIP] Update Macie support - CORE-387 May 5, 2023
@arsci arsci changed the title [WIP] Update Macie support - CORE-387 Update Macie support - CORE-387 May 8, 2023
ellisonc
ellisonc previously approved these changes May 8, 2023
aws/macie_test.go Outdated Show resolved Hide resolved
aws/macie_test.go Outdated Show resolved Hide resolved
denis256
denis256 previously approved these changes May 8, 2023
// Macie cannot be disabled with an active administrator account
adminAccount, err := svc.GetAdministratorAccount(&macie2.GetAdministratorAccountInput{})
if err != nil {
if strings.Contains(err.Error(), "there isn't a delegated Macie administrator") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we key off the error's numeric code instead of string matching? My fear is that AWS changes the value out from under us without us knowing and this starts to break.

Copy link
Contributor Author

@arsci arsci May 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zackproser I thought about using it, unfortunately it's just a generic ResourceNotFoundException (which is the same error that gets returned if Macie isn't enabled). I figured it might be better to key off of the specific message in this case, but I am definitely open to going the other way, I could see AWS potentially changing the error message breaking this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arsci No problem - I was thinking this could be the case. Let's not obsess over it in that case! 👍

@zackproser
Copy link
Contributor

Nicely done!

Copy link
Contributor

@zackproser zackproser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@arsci arsci merged commit 60cca18 into master May 9, 2023
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants