Skip to content

Commit 23dc0da

Browse files
openfinchJosh Finch
and
Josh Finch
authored
Moved volume and placementConstraints to dynamics (#23)
Co-authored-by: Josh Finch <[email protected]>
1 parent cfcc1dd commit 23dc0da

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

main.tf

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,32 @@ resource "aws_ecs_task_definition" "ecs_task_definition" {
175175
ipc_mode = "${var.ipc_mode}"
176176
network_mode = "${var.network_mode}"
177177
pid_mode = "${var.pid_mode}"
178-
placement_constraints = "${var.placement_constraints}"
179178
requires_compatibilities = "${var.requires_compatibilities}"
180179
task_role_arn = "${var.task_role_arn}"
181-
volume = "${var.volumes}"
180+
181+
dynamic "volume" {
182+
for_each = [for v in var.volumes : {
183+
name = v.name
184+
host_path = v.host_path
185+
}]
186+
187+
content {
188+
name = volume.value.name
189+
host_path = volume.value.host_path
190+
}
191+
}
192+
193+
dynamic "placement_constraints" {
194+
for_each = [for v in var.placement_constraints : {
195+
type = v.type
196+
expression = v.expression
197+
}]
198+
199+
content {
200+
type = volume.value.type
201+
expression = volume.value.expression
202+
}
203+
}
182204

183205
count = "${var.register_task_definition ? 1 : 0}"
184206
}

0 commit comments

Comments
 (0)