File tree Expand file tree Collapse file tree 4 files changed +15
-12
lines changed
Expand file tree Collapse file tree 4 files changed +15
-12
lines changed Original file line number Diff line number Diff line change @@ -123,4 +123,13 @@ locals {
123123 }
124124 ]
125125 }
126+
127+ final_task_definitions = {
128+ for key , task_def in local . resolved_task_definitions : key => merge (
129+ task_def,
130+ {
131+ container_definitions = local.container_definitions_map[key]
132+ }
133+ )
134+ }
126135}
Original file line number Diff line number Diff line change @@ -18,8 +18,7 @@ module "service" {
1818}
1919
2020module "task" {
21- source = " ./task"
22- container_definitions_map = local. container_definitions_map
23- ecs_task_definitions = var. ecs_task_definitions
24- tags = var. tags
25- }
21+ source = " ./task"
22+ ecs_task_definitions = local. final_task_definitions
23+ tags = var. tags
24+ }
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ resource "aws_ecs_task_definition" "dev" {
99 execution_role_arn = each. value . execution_role_arn
1010 requires_compatibilities = each. value . requires_compatibilities
1111
12- container_definitions = jsonencode (var . container_definitions_map [ each . key ] )
12+ container_definitions = jsonencode (each. value . container_definitions )
1313
1414 dynamic "volume" {
1515 for_each = each. value . volumes
Original file line number Diff line number Diff line change @@ -9,21 +9,16 @@ variable "ecs_task_definitions" {
99 execution_role_arn = string
1010 requires_compatibilities = list (string )
1111 container_port = list (number )
12- command = optional (string )
1312 host_port = list (number )
1413 volumes = optional (list (object ({
1514 name = string
1615 host_path = string
1716 })), [])
1817 environment = optional (map (string ), {})
18+ container_definitions = any
1919 }))
2020}
2121
22- variable "container_definitions_map" {
23- description = " Map of ECS service names to their container definitions"
24- type = map (any )
25- }
26-
2722variable "tags" {
2823 type = map (string )
2924 default = {}
You can’t perform that action at this time.
0 commit comments