File tree Expand file tree Collapse file tree 3 files changed +14
-4
lines changed Expand file tree Collapse file tree 3 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -89,6 +89,7 @@ Module managed by [Marcin Cuber](https://github.com/marcincuber) [LinkedIn](http
8989| task\_ definition\_ memory | The soft limit (in MiB) of memory to reserve for the container. | number | ` "512" ` | no |
9090| task\_ host\_ port | The port number on the container instance to reserve for your container. | number | ` "0" ` | no |
9191| target\_ group\_ name | The name for the tasks target group. | string | ` "" ` | no |
92+ | load\_ balanced | Whether the task should be loadbalanced. | bool | ` true ` | no |
9293
9394## Outputs
9495
Original file line number Diff line number Diff line change @@ -181,10 +181,13 @@ resource "aws_ecs_service" "service" {
181181 assign_public_ip = var. task_container_assign_public_ip
182182 }
183183
184- load_balancer {
185- container_name = var. container_name != " " ? var. container_name : var. name_prefix
186- container_port = var. task_container_port
187- target_group_arn = aws_lb_target_group. task . arn
184+ dynamic "load_balancer" {
185+ for_each = var. load_balanced ? [1 ] : []
186+ content {
187+ container_name = var. container_name != " " ? var. container_name : var. name_prefix
188+ container_port = var. task_container_port
189+ target_group_arn = aws_lb_target_group. task . arn
190+ }
188191 }
189192
190193 deployment_controller {
Original file line number Diff line number Diff line change @@ -158,3 +158,9 @@ variable "target_group_name" {
158158 default = " "
159159 description = " The name for the tasks target group"
160160}
161+
162+ variable "load_balanced" {
163+ type = bool
164+ default = true
165+ description = " Whether the task should be loadbalanced."
166+ }
You can’t perform that action at this time.
0 commit comments