Skip to content

ECS task definitions should not share the host's process namespace

This control checks if AWS ECS task definitions are configured to share a host's process namespace with its containers. The control fails if the task definition shares the host's process namespace with the containers running on it.

How to fix

Attribute pid_mode of aws_ecs_task_definition must satisfy condition: not_equals.

Implementation options

Choose the option that matches how you manage Terraform. All options satisfy this control.

Option 1: Terraform AWS provider resources

If you manage resources directly, configure the relevant Terraform AWS provider resources to meet this control. See docs for the resources involved: aws_ecs_task_definition.

resource "aws_ecs_task_definition" "this" {
  container_definitions    = jsonencode([{ name = "app", image = "nginx:latest", essential = true, portMappings = [{ containerPort = 80 }] }])
  cpu                      = "256"
  family                   = "pofix-example"
  memory                   = "512"
  network_mode             = "awsvpc"
  requires_compatibilities = ["FARGATE"]
}
Which option should I choose?
  • Compliance.tf module (recommended): controls enforced by default and mapped to frameworks.
  • Open source module (terraform-aws-modules): compatible by design with compliance.tf. Same variable names for an easy, low-change migration path when you are ready.
  • Terraform AWS provider resources: manage Terraform resources directly.

Tool mappings

Use these identifiers to cross-reference this control across tools, reports, and evidence.

  • Compliance.tf (CTF) Control: ecs_task_definition_no_host_pid_mode

  • Checkov Check: CKV_AWS_335

  • Powerpipe Control: aws_compliance.control.ecs_task_definition_no_host_pid_mode