Skip to content

Files

Latest commit

 

History

History
52 lines (41 loc) · 1.02 KB

aws-ecs-no-plaintext-secrets.md

File metadata and controls

52 lines (41 loc) · 1.02 KB

Pattern: Use of plain-text secret for AWS ECS task definition

Issue: -

Description

You should not make secrets available to a user in plain-text in any scenario. Secrets can instead be pulled from a secure secret storage system by the service requiring them.

Resolution: Use secrets for the task definition.

Examples

Example of incorrect code:

resource "aws_ecs_task_definition" "bad_example" {
  container_definitions = <<EOF
[
  {
    "name": "my_service",
    "essential": true,
    "memory": 256,
    "environment": [
      { "name": "ENVIRONMENT", "value": "development" },
      { "name": "DATABASE_PASSWORD", "value": "oh no D:"}
    ]
  }
]
EOF

}

Example of correct code:

resource "aws_ecs_task_definition" "good_example" {
  container_definitions = <<EOF
[
  {
    "name": "my_service",
    "essential": true,
    "memory": 256,
    "environment": [
      { "name": "ENVIRONMENT", "value": "development" }
    ]
  }
]
EOF

}