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

Feature/116 iam groups #364

Merged
merged 9 commits into from
Oct 31, 2022
Merged

Conversation

ellisonc
Copy link

@ellisonc ellisonc commented Sep 29, 2022

Description

Fixes #116.

Adds the ability to nuke IAM Groups

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.

Release Notes (draft)

Added support for nuking IAM Groups and customer managed IAM Policies

Migration Guide

aws/iam_group.go Outdated
return false
}

if excludeAfter.Before(*iamGroup.CreateDate) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Prefer the AWS SDK convenience methods for dereferencing a pointer, i.e, aws.TimeValue

@zackproser
Copy link
Contributor

Looks like not just a terrific start, but ultimately pretty close to being merge-able! 👏

@ellisonc ellisonc requested review from zackproser and removed request for yorinasub17 and rhoboat October 27, 2022 14:58
@ellisonc ellisonc changed the title WIP Feature/116 iam groups Feature/116 iam groups Oct 27, 2022
@zackproser
Copy link
Contributor

zackproser commented Oct 31, 2022

This is pretty non-intuitive, but every time you add a new resource to cloud-nuke, you need to go here and add the exact line ResourceType{FilterRule{}, FilterRule{}}, the same number of times as you added resources.

So, in this case you'll need to add that line twice - otherwise you'll get a warning when trying to run tests about too few resources being defined in the config test.

@zackproser
Copy link
Contributor

Did a bunch of smoke testing locally:

  • Creating and nuking IAM users
  • Creating and nuking IAM users while excluding a special user via config file
  • Create and nuking IAM users that are members of groups with and without policies attached
  • Creating and nuking IAM policies while excluding a special policy via config file

All have worked flawlessly. Well done 👍

"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
Copy link
Contributor

Choose a reason for hiding this comment

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

NIT: Sid is another place you could feel free to put some more debug / Grunt-facing info about this policy (as you did in the description), if you wanted: https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_sid.html.

Might make it easier to visually identity what we're looking at once we're digging through an AWS account debugging.

@zackproser
Copy link
Contributor

@ellisonc Very nice work. This looks solid to me. Want to resolve the merge conflicts so I can approve?

…roups

# Conflicts:
#	config/config_test.go
@ellisonc
Copy link
Author

@zackproser thanks! Just merged upstream back in to fix the conflict

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

@zackproser
Copy link
Contributor

@ellisonc would you like to do the honors of merging and releasing per the instructions here?

@ellisonc ellisonc merged commit 076543c into gruntwork-io:master Oct 31, 2022
@arsci arsci mentioned this pull request Apr 10, 2023
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.

Feature Request: add ability to delete users, groups, and policies
2 participants