Created
April 22, 2023 17:25
-
-
Save omenking/6564ad312cb9398ad5427204253cfed5 to your computer and use it in GitHub Desktop.
task-definition.guard
This file contains hidden or 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
aws_ecs_cluster_configuration { | |
rules = [ | |
{ | |
rule = "task_definition_encryption" | |
description = "Ensure task definitions are encrypted" | |
level = "error" | |
action { | |
type = "disallow" | |
message = "Task definitions in the Amazon ECS cluster must be encrypted" | |
} | |
match { | |
type = "ecs_task_definition" | |
expression = "encrypt == false" | |
} | |
}, | |
{ | |
rule = "network_mode" | |
description = "Ensure Fargate tasks use awsvpc network mode" | |
level = "error" | |
action { | |
type = "disallow" | |
message = "Fargate tasks in the Amazon ECS cluster must use awsvpc network mode" | |
} | |
match { | |
type = "ecs_task_definition" | |
expression = "network_mode != 'awsvpc'" | |
} | |
}, | |
{ | |
rule = "execution_role" | |
description = "Ensure Fargate tasks have an execution role" | |
level = "error" | |
action { | |
type = "disallow" | |
message = "Fargate tasks in the Amazon ECS cluster must have an execution role" | |
} | |
match { | |
type = "ecs_task_definition" | |
expression = "execution_role == null" | |
} | |
}, | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment