terraform-aws-ecs-service
terraform-aws-ecs-service copied to clipboard
ECS Volumes Are Incorrectly Defined As Arguments Instead of Blocks (No Equal Sign Allowed)
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"
}
}
} }