-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(checks): check only clusters in AVD-AWS-0343
Signed-off-by: Nikita Pivkin <[email protected]>
- Loading branch information
Showing
2 changed files
with
9 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 8 additions & 2 deletions
10
checks/cloud/aws/rds/enable_cluster_deletion_protection_test.rego
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,17 @@ | ||
package builtin.aws.rds.aws0343 | ||
|
||
test_detects_when_disabled { | ||
test_deny_deletion_protection_disabled { | ||
r := deny with input as {"aws": {"rds": {"clusters": [{"deletionprotection": {"value": false}}]}}} | ||
count(r) == 1 | ||
} | ||
|
||
test_when_enabled { | ||
test_allow_deletion_protection_enabled { | ||
r := deny with input as {"aws": {"rds": {"clusters": [{"deletionprotection": {"value": true}}]}}} | ||
count(r) == 0 | ||
} | ||
|
||
# If there is no cluster for database instances, they are added to an empty cluster. | ||
test_allow_deletion_protection_disabled_but_instances_orphaned { | ||
r := deny with input as {"aws": {"rds": {"clusters": [{"deletionprotection": {"__defsec_metadata": {"managed": false}, "value": false}}]}}} | ||
count(r) == 0 | ||
} |