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

feat(experimental): filter groups #263

Merged
merged 2 commits into from
Oct 17, 2024
Merged

feat(experimental): filter groups #263

merged 2 commits into from
Oct 17, 2024

Conversation

ekristen
Copy link
Owner

@ekristen ekristen commented Aug 28, 2024

Overview

By default all filters are part of group default, this allows you to set group: <value> for any filter.

Filters within the same group are OR, meaning if any are true, then the resource is filtered.

If more than 1 filter group is present, they are ANDed together and both groups must be true for the filter to match.

Example Output

This is the filter definition

    filters:
      IAMUser:
        - value: "testing"
          type: contains
          group: group1
        - property: tag:test
          value: "alpha"
          group: group2

WITHOUT filter groups, both resources get filtered because they match 1 or more filters.

global - IAMUser - testing - [CreateDate: "2024-10-15T22:42:39Z", Name: "testing", Path: "/", UserID: "AIDAZI2LHXQ5T2ABOSX2H"] - filtered by config
global - IAMUser - testing12345 - [CreateDate: "2024-10-15T22:42:52Z", Name: "testing12345", Path: "/", UserID: "AIDAZI2LHXQ5YFP5X4QVZ", tag:test: "alpha"] - filtered by config
Scan complete: 2 total, 0 nukeable, 2 filtered.

WITH filter groups enabled via --feature-flag filter-groups, only a single resource gets filtered because it has to match BOTH because there are two groups defined.

global - IAMUser - testing - [CreateDate: "2024-10-15T22:42:39Z", Name: "testing", Path: "/", UserID: "AIDAZI2LHXQ5T2ABOSX2H"] - would remove
global - IAMUser - testing12345 - [CreateDate: "2024-10-15T22:42:52Z", Name: "testing12345", Path: "/", UserID: "AIDAZI2LHXQ5YFP5X4QVZ", tag:test: "alpha"] - filtered by config
Scan complete: 2 total, 1 nukeable, 1 filtered.

References

@ekristen ekristen marked this pull request as draft August 28, 2024 20:08
@ekristen ekristen changed the title feat(deps): libnuke@2f43f05ef66d - filter groups feat: filter groups Oct 15, 2024
@ekristen ekristen marked this pull request as ready for review October 15, 2024 22:34
@ekristen ekristen changed the title feat: filter groups feat(experimental): filter groups Oct 15, 2024
@ekristen ekristen merged commit 580e52b into main Oct 17, 2024
14 checks passed
@ekristen ekristen deleted the feat-filter-groups branch October 17, 2024 13:53
@ekristen
Copy link
Owner Author

🎉 This PR is included in version 3.28.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Request: support for logical "and" for filters
1 participant