0.8.1
In the aws_ecs_task_definition
you can specify a single volume. However the AWS API documentation mentions you can specify multiple volumes. It would be nice if that would also be possible within aws_ecs_task_definition
.
Sorry, clearly a RTFM
How is this clearly an RTFM?
I have RTFM, and terraform does not support a plurality of volumes. The source code shows it doesn't support lists of volumes or a JSON block.
You can just repeat the volume block to add multiple volumes.
There is no indication on https://www.terraform.io/docs/providers/aws/r/ecs_task_definition.html#volume that the volume block can be resused. I think it should be added to the documentation since at least a few people are confused.
Hey everyone,
Just to let you know that the documentation has been updated accordingly, and the website should reflect it on the next release.
Here is my user case.
It is hard to set volume blocks with different applications in terraform modules.
volume {
name = "service-storage"
host_path = "/ecs/service-storage"
}
volume {
name = "www"
host_path = "/var/www/html"
}
Which I prefer
volumes = [
{
"name": "service-storage",
"host": {
"sourcePath": "/ecs/service-storage"
}
},
{
"name": "www",
"host": {
"sourcePath": "/var/www/html"
}
}
]
with that, I can define it as exteral json file as well , same as container_definitions ((sample: https://www.terraform.io/docs/providers/aws/r/ecs_task_definition.html) ), what ever how many volumes need be added.
container_definitions = "${file("task-definitions/service.json")}"
volumes = "${file("task-definitions/volumes.json")}"
Because of this reason, I have to take this resource aws_ecs_task_definition
out of a ECS service terraform module. It is bad.
@ozbillwang I've got exactly the same problem. Did you find an acceptable workaround?!
@tomstockton
I by-pass the volume setting and use links
option in task definition, so containers in same task definition can share the folders.
For example, when build image, add below line in Dockerfile
VOLUME /var/www/html /ecs/service-storage
In task definition, add below lines
"links": [
"${app_name}:application"
],
Loading volumes from whatever external source is fundamental here. Moving the task_definition out of any ecs service modules is a big frustration because it makes the module resource (service) depending from an "interface" value (task_definition arn). Really bad and pointless.
Any chances to have this feature?
I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Most helpful comment
There is no indication on https://www.terraform.io/docs/providers/aws/r/ecs_task_definition.html#volume that the volume block can be resused. I think it should be added to the documentation since at least a few people are confused.