Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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