-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated the dict_merge and required functions that is dependening on it.
- Loading branch information
Showing
9 changed files
with
152 additions
and
83 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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
resource "aws_dynamodb_table" "test" { | ||
name = "test-table" | ||
billing_mode = "PROVISIONED" | ||
read_capacity = 20 | ||
write_capacity = 20 | ||
hash_key = "UserId" | ||
range_key = "GameTitle" | ||
|
||
attribute { | ||
name = "UserId" | ||
type = "S" | ||
} | ||
|
||
attribute { | ||
name = "GameTitle" | ||
type = "S" | ||
} | ||
|
||
attribute { | ||
name = "TopScore" | ||
type = "N" | ||
} | ||
|
||
ttl { | ||
attribute_name = "TimeToExist" | ||
enabled = false | ||
} | ||
|
||
global_secondary_index { | ||
name = "GameTitleIndex" | ||
hash_key = "GameTitle" | ||
range_key = "TopScore" | ||
write_capacity = 10 | ||
read_capacity = 10 | ||
projection_type = "INCLUDE" | ||
non_key_attributes = ["UserId"] | ||
} | ||
|
||
server_side_encryption { | ||
enabled = true | ||
kms_key_arn = aws_kms_key.test.arn | ||
} | ||
|
||
tags = { | ||
Name = "dynamodb-table-1" | ||
Environment = "production" | ||
} | ||
} | ||
|
||
resource "aws_kms_key" "test" { | ||
description = "Test" | ||
} |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
{"format_version":"0.1","terraform_version":"0.12.20","planned_values":{"root_module":{"resources":[{"address":"aws_dynamodb_table.test","mode":"managed","type":"aws_dynamodb_table","name":"test","provider_name":"aws","schema_version":1,"values":{"attribute":[{"name":"GameTitle","type":"S"},{"name":"TopScore","type":"N"},{"name":"UserId","type":"S"}],"billing_mode":"PROVISIONED","global_secondary_index":[{"hash_key":"GameTitle","name":"GameTitleIndex","non_key_attributes":["UserId"],"projection_type":"INCLUDE","range_key":"TopScore","read_capacity":10,"write_capacity":10}],"hash_key":"UserId","local_secondary_index":[],"name":"test-table","range_key":"GameTitle","read_capacity":20,"server_side_encryption":[{"enabled":true}],"stream_enabled":null,"tags":{"Environment":"production","Name":"dynamodb-table-1"},"timeouts":null,"ttl":[{"attribute_name":"TimeToExist","enabled":false}],"write_capacity":20}},{"address":"aws_kms_key.test","mode":"managed","type":"aws_kms_key","name":"test","provider_name":"aws","schema_version":0,"values":{"customer_master_key_spec":"SYMMETRIC_DEFAULT","deletion_window_in_days":null,"description":"Test","enable_key_rotation":false,"is_enabled":true,"key_usage":"ENCRYPT_DECRYPT","tags":null}}]}},"resource_changes":[{"address":"aws_dynamodb_table.test","mode":"managed","type":"aws_dynamodb_table","name":"test","provider_name":"aws","change":{"actions":["create"],"before":null,"after":{"attribute":[{"name":"GameTitle","type":"S"},{"name":"TopScore","type":"N"},{"name":"UserId","type":"S"}],"billing_mode":"PROVISIONED","global_secondary_index":[{"hash_key":"GameTitle","name":"GameTitleIndex","non_key_attributes":["UserId"],"projection_type":"INCLUDE","range_key":"TopScore","read_capacity":10,"write_capacity":10}],"hash_key":"UserId","local_secondary_index":[],"name":"test-table","range_key":"GameTitle","read_capacity":20,"server_side_encryption":[{"enabled":true}],"stream_enabled":null,"tags":{"Environment":"production","Name":"dynamodb-table-1"},"timeouts":null,"ttl":[{"attribute_name":"TimeToExist","enabled":false}],"write_capacity":20},"after_unknown":{"arn":true,"attribute":[{},{},{}],"global_secondary_index":[{"non_key_attributes":[false]}],"id":true,"local_secondary_index":[],"point_in_time_recovery":true,"server_side_encryption":[{"kms_key_arn":true}],"stream_arn":true,"stream_label":true,"stream_view_type":true,"tags":{},"ttl":[{}]}}},{"address":"aws_kms_key.test","mode":"managed","type":"aws_kms_key","name":"test","provider_name":"aws","change":{"actions":["create"],"before":null,"after":{"customer_master_key_spec":"SYMMETRIC_DEFAULT","deletion_window_in_days":null,"description":"Test","enable_key_rotation":false,"is_enabled":true,"key_usage":"ENCRYPT_DECRYPT","tags":null},"after_unknown":{"arn":true,"id":true,"key_id":true,"policy":true}}}],"configuration":{"root_module":{"resources":[{"address":"aws_dynamodb_table.test","mode":"managed","type":"aws_dynamodb_table","name":"test","provider_config_key":"aws","expressions":{"attribute":[{"name":{"constant_value":"UserId"},"type":{"constant_value":"S"}},{"name":{"constant_value":"GameTitle"},"type":{"constant_value":"S"}},{"name":{"constant_value":"TopScore"},"type":{"constant_value":"N"}}],"billing_mode":{"constant_value":"PROVISIONED"},"global_secondary_index":[{"hash_key":{"constant_value":"GameTitle"},"name":{"constant_value":"GameTitleIndex"},"non_key_attributes":{"constant_value":["UserId"]},"projection_type":{"constant_value":"INCLUDE"},"range_key":{"constant_value":"TopScore"},"read_capacity":{"constant_value":10},"write_capacity":{"constant_value":10}}],"hash_key":{"constant_value":"UserId"},"name":{"constant_value":"test-table"},"range_key":{"constant_value":"GameTitle"},"read_capacity":{"constant_value":20},"server_side_encryption":[{"enabled":{"constant_value":true},"kms_key_arn":{"references":["aws_kms_key.test"]}}],"tags":{"constant_value":{"Environment":"production","Name":"dynamodb-table-1"}},"ttl":[{"attribute_name":{"constant_value":"TimeToExist"},"enabled":{"constant_value":false}}],"write_capacity":{"constant_value":20}},"schema_version":1},{"address":"aws_kms_key.test","mode":"managed","type":"aws_kms_key","name":"test","provider_config_key":"aws","expressions":{"description":{"constant_value":"Test"}},"schema_version":0}]}}} |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Feature: Image scan to be enabled on push to ECR | ||
This feature will enforce vulnerabilty scan on images pushed to ECR | ||
| ||
Scenario: Image scan to be enabled on push. | ||
Given I have aws_dynamodb_table defined | ||
Then it must contain server_side_encryption | ||
And it must contain kms_key_arn |
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from unittest import TestCase | ||
from terraform_compliance.common.bdd_tags import look_for_bdd_tags | ||
from terraform_compliance.common.exceptions import Failure | ||
from tests.mocks import MockedStep, MockedTags | ||
|
||
|
||
class TestBddTags(TestCase): | ||
|
||
def test_unchanged_step_object(self): | ||
step = MockedStep() | ||
look_for_bdd_tags(step) | ||
self.assertFalse(step.context.no_failure) | ||
self.assertIsNone(step.context.failure_class) | ||
|
||
def test_warning_case(self): | ||
step = MockedStep() | ||
step.all_tags = [MockedTags(name='warning')] | ||
look_for_bdd_tags(step) | ||
self.assertTrue(step.context.no_failure) | ||
self.assertEqual(step.context.failure_class, 'warning') |
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