-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add tests for AWS ECS Signed-off-by: Vishal Choudhary <[email protected]> * fix: update message in validating policy Signed-off-by: Vishal Choudhary <[email protected]> * feat: linting Signed-off-by: Vishal Choudhary <[email protected]> --------- Signed-off-by: Vishal Choudhary <[email protected]> Co-authored-by: Charles-Edouard Brétéché <[email protected]>
- Loading branch information
1 parent
2825860
commit dd3b385
Showing
17 changed files
with
1,180 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Loading policies ... | ||
Loading payload ... | ||
Pre processing ... | ||
Running ( evaluating 3 resources against 1 policy ) ... | ||
- required-container-insights / required-container-insights / (unknown) PASSED | ||
Done |
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 @@ | ||
apiVersion: json.kyverno.io/v1alpha1 | ||
kind: ValidatingPolicy | ||
metadata: | ||
name: required-container-insights | ||
spec: | ||
rules: | ||
- name: required-container-insights | ||
match: | ||
any: | ||
- type: aws_ecs_cluster | ||
assert: | ||
all: | ||
- message: "Container insights should be enabled on ECS cluster" | ||
check: | ||
values: | ||
~.setting: | ||
name: containerInsights | ||
value: enabled | ||
|
||
|
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,6 @@ | ||
Loading policies ... | ||
Loading payload ... | ||
Pre processing ... | ||
Running ( evaluating 3 resources against 1 policy ) ... | ||
- ecs-cluster-enable-logging / ecs-cluster-enable-logging / (unknown) PASSED | ||
Done |
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,21 @@ | ||
apiVersion: json.kyverno.io/v1alpha1 | ||
kind: ValidatingPolicy | ||
metadata: | ||
name: ecs-cluster-enable-logging | ||
spec: | ||
rules: | ||
- name: ecs-cluster-enable-logging | ||
match: | ||
any: | ||
- type: aws_ecs_cluster | ||
context: | ||
- name: forbidden_values | ||
variable: ["NONE"] | ||
assert: | ||
all: | ||
- message: "ECS Cluster should enable logging of ECS Exec" | ||
check: | ||
values: | ||
~.configuration: | ||
~.execute_command_configuration: | ||
(contains($forbidden_values, @.logging)): false |
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,29 @@ | ||
resource "aws_kms_key" "example" { | ||
description = "example" | ||
deletion_window_in_days = 7 | ||
} | ||
|
||
resource "aws_cloudwatch_log_group" "example" { | ||
name = "example" | ||
} | ||
|
||
resource "aws_ecs_cluster" "test" { | ||
name = "example" | ||
|
||
configuration { | ||
execute_command_configuration { | ||
kms_key_id = aws_kms_key.example.arn | ||
logging = "OVERRIDE" | ||
|
||
log_configuration { | ||
cloud_watch_encryption_enabled = true | ||
cloud_watch_log_group_name = aws_cloudwatch_log_group.example.name | ||
} | ||
} | ||
} | ||
|
||
setting { | ||
name = "containerInsights" | ||
value = "enabled" | ||
} | ||
} |
Oops, something went wrong.