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

Fix the example for resources that do not support the Tags property #285

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
21 changes: 12 additions & 9 deletions guard-examples/encryption/dynamodb-table-sse.guard
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
#
# Common rule, all resources must have Tags present on them
#
rule assert_all_resources_have_non_empty_tags {
Resources.*.Properties.Tags !empty
}

#
# Select all DDB resources from the incoming template (payload)
#
let ddb = Resources.*[ Type == 'AWS::DynamoDB::Table' ]

#
# Common rule, DDB table resources must have Tags present on them
#
rule assert_ddb_resources_have_non_empty_tags
{
#
# Ensure ALL DynamoDB Tables have tags
#
%ddb.Properties.Tags !empty
}
#
# Run this DDB rule when there are DDB table present and
# we PASSED the check that all resources did have tags in them
# we PASSED the check that DDB table resources did have tags in them
#
# Rule Intent: ALL DDB Table must have encryption at rest turned
# on.
Expand All @@ -23,7 +26,7 @@ let ddb = Resources.*[ Type == 'AWS::DynamoDB::Table' ]
# c) FAIL if wasn't set for them
#
rule dynamo_db_sse_on when %ddb !empty
assert_all_resources_have_non_empty_tags
assert_ddb_resources_have_non_empty_tags
{
#
# Ensure ALL DynamoDB Tables have encryption at rest turned on
Expand Down
Loading
Loading