-
Notifications
You must be signed in to change notification settings - Fork 1
[PLAT-71] Allow define one optional volume #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
For some cases and workloads we need to pass some modules to the task definition. The volumes are passed as a list of maps to the ecs_task_resource[1]. But the current syntax of terraform does not allow consume this value directly from a variable. Trying to do so, we hit the issues described in [2] and [3] (pending to report a specific bug). But we found out that it works if we build the map structure directly within the resource, and we use interpolation to consume the values of the map. Meanwhile the terraform project does not provide a definitive solution, we will implement the following workaround: - The module will receive configuration for one unique module, being the default a empty map {} - If the map is empty, a dummy volume will be passed as `name=dummy` and `host_path=/tmp/dummy_volume` This would cover our specific case in the short term, and can be later easily adapted to use a optional list of volumes. [1] https://www.terraform.io/docs/providers/aws/r/ecs_task_definition.html#volume [2] hashicorp/terraform#10407 [3] hashicorp/terraform#7705 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good - just two comments?
"host_path"= "/tmp" | ||
} | ||
] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this being defined here and in variables.tf
on purpose? Would this not cause error?
] | ||
} | ||
|
||
output volumes { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a useful, potential reason for this output?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I accidentally added those.
Closing it to remove spurious variable and output |
For some cases and workloads we need to pass some modules to the task definition. The volumes are passed as a list of maps to the
ecs_task_resource
[1].But the current syntax of terraform does not allow consume this value directly from a variable. Trying to do so, we hit the issues described in [2] and [3] (pending to report a specific bug).
But we found out that it works if we build the map structure directly within the resource, and we use interpolation to consume the values of the map.
Meanwhile the terraform project does not provide a definitive solution, we
will implement the following workaround:
name=dummy
andhost_path=/tmp/dummy_volume
This would cover our specific case in the short term, and can be later easily adapted to use a optional list of volumes.
[1] https://www.terraform.io/docs/providers/aws/r/ecs_task_definition.html#volume
[2] hashicorp/terraform#10407
[3] hashicorp/terraform#7705 (comment)