File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed
Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,22 @@ resource "aws_ecs_task_definition" "task" {
2828 portMappings = local.balanced && local.load_balancer_container_name == s.name ? coalescelist (var. port_mappings , local. defaultPortMappings ) : []
2929 })])
3030
31+ dynamic "volume" {
32+ for_each = [for efs_vol in var . efs_volumes : {
33+ name = " ${ var . cluster_name } -${ efs_vol . efs_id } "
34+ efs_id = efs_vol.efs_id
35+ root_directory = efs_vol.root_dir ? efs_vol.root_dir : " /opt/data"
36+ }]
37+
38+ content {
39+ name = volume. value . name
40+ efs_volume_configuration {
41+ file_system_id = volume. value . efs_id
42+ root_directory = volume. value . root_directory
43+ }
44+ }
45+ }
46+
3147 task_role_arn = var. task_role_arn
3248
3349 # the /tmp volume is needed if the root fs is readonly
Original file line number Diff line number Diff line change @@ -115,6 +115,11 @@ variable "user" {
115115 default = " "
116116}
117117
118+ variable "efs_volumes" {
119+ description = " Optional list of efs volumes, which are a map with {efs_id:, root_dir:}"
120+ type = list (map (string ))
121+ default = {}
122+ }
118123
119124locals {
120125 balanced = var. container_port > 0
You can’t perform that action at this time.
0 commit comments