terraform-aws-ecs-service icon indicating copy to clipboard operation
terraform-aws-ecs-service copied to clipboard

ECS Volumes Are Incorrectly Defined As Arguments Instead of Blocks (No Equal Sign Allowed)

Open grahamschuckman opened this issue 2 years ago • 0 comments

Volumes are defined with equal signs in your code which is not permitted by Terraform. Volumes for ECS have to be defined as blocks just using the {}. See documentation for reference: https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_task_definition

volume { name = "service-storage" host_path = "/ecs/service-storage" }

The same is true for any configuration blocks inside your volume block, such as efs_volume_configuration:

resource "aws_ecs_task_definition" "service" { family = "service" container_definitions = file("task-definitions/service.json")

volume { name = "service-storage"

efs_volume_configuration {
  file_system_id          = aws_efs_file_system.fs.id
  root_directory          = "/opt/data"
  transit_encryption      = "ENABLED"
  transit_encryption_port = 2999
  authorization_config {
    access_point_id = aws_efs_access_point.test.id
    iam             = "ENABLED"
  }
}

} }

grahamschuckman avatar Apr 04 '22 15:04 grahamschuckman