Skip to content

Commit 5713f82

Browse files
committed
docs: filter groups
1 parent 4f04daf commit 5713f82

File tree

4 files changed

+59
-1
lines changed

4 files changed

+59
-1
lines changed

docs/cli-experimental.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ aws-nuke run --feature-flag "wait-on-dependencies"
2020

2121
## Available Feature Flags
2222

23+
- `filter-groups` - This feature flag will cause aws-nuke to filter based on a grouping method which allows for AND'ing
24+
filters together.
2325
- `wait-on-dependencies` - This feature flag will cause aws-nuke to wait for all resource type dependencies to be
2426
deleted before deleting the next resource type.
2527

@@ -32,4 +34,21 @@ an attached policy.
3234
The problem is that if you delete the IAM Role first, it will fail because it has a dependency on the policy.
3335

3436
This feature flag will cause aws-nuke to wait for all resources of a given type to be deleted before deleting the next
35-
resource type. This will reduce the number of errors and unnecessary API calls.
37+
resource type. This will reduce the number of errors and unnecessary API calls.
38+
39+
### filter-groups
40+
41+
This feature flag will cause aws-nuke to filter resources based on a group method. This is useful when filters need
42+
to be AND'd together. For example, if you want to delete all resources that are tagged with `env:dev` and `namespace:test`
43+
you can use the following filter group:
44+
45+
```yaml
46+
filters:
47+
ResourceType:
48+
- property: tag:env
49+
value: dev
50+
group: group1
51+
- property: tag:namespace
52+
value: test
53+
group: group2
54+
```

docs/config-filtering.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,33 @@ against some resources and not others.
2121
Global works by taking all filters defined under `__global__` and prepends to any filters found for a resource type. If
2222
a resource does NOT have any filters defined, the `__global__` ones will still be used.
2323

24+
## Filter Groups
25+
26+
!!! important
27+
Filter groups are an experimental feature and are disabled by default. To enable filter groups, use the
28+
`--feature-flag filter-groups` flag.
29+
30+
Filter groups are used to group filters together. This is useful when filters need to be AND'd together. For example,
31+
if you want to delete all resources that are tagged with `env:dev` and `namespace:test` you can use the following filter
32+
group:
33+
34+
```yaml
35+
filters:
36+
ResourceType:
37+
- property: tag:env
38+
value: dev
39+
group: group1
40+
- property: tag:namespace
41+
value: test
42+
group: group2
43+
```
44+
45+
In this example, the `group1` and `group2` filters are AND'd together. This means that a resource must match both filters
46+
to be excluded from deletion.
47+
48+
Only a single filter in a group is required to match. This means that if a resource matches any filter in a group it will
49+
count as a match for the group.
50+
2451
### Example
2552

2653
In this example, we are ignoring all resources that have the tag `aws-nuke` set to `ignore`. Additionally filtering

docs/features/filter-groups.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Filter Groups
2+
3+
!!! important
4+
This feature is experimental and is disabled by default. To enable it, use the `--feature-flag "filter-groups"` CLI argument.
5+
6+
Filter groups allow you to filter resources based on a grouping method which allows for AND'ing filters together. By
7+
default, all filters belong to the same group, but you can specify a group name to group filters together.
8+
9+
All filters within a group are OR'd together, and all groups are AND'd together.
10+
11+
[Full Documentation](../config-filtering.md#filter-groups)

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ nav:
7777
- Overview: features/overview.md
7878
- Bypass Alias Check: features/bypass-alias-check.md
7979
- Global Filters: features/global-filters.md
80+
- Filter Groups: features/filter-groups.md
8081
- Enabled Regions: features/enabled-regions.md
8182
- Signed Binaries: features/signed-binaries.md
8283
- CLI:

0 commit comments

Comments
 (0)