File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -214,7 +214,7 @@ resource "aws_ecs_service" "service" {
214214 cluster = var. cluster_id
215215 task_definition = var. task_definition != " " ? var. task_definition : aws_ecs_task_definition. task . arn
216216 desired_count = var. desired_count
217- launch_type = " FARGATE"
217+ launch_type = length (var . capacity_provider_strategy ) == 0 ? " FARGATE" : null
218218 deployment_minimum_healthy_percent = var. deployment_minimum_healthy_percent
219219 deployment_maximum_percent = var. deployment_maximum_percent
220220 health_check_grace_period_seconds = var. lb_arn == " " ? null : var. health_check_grace_period_seconds
@@ -262,6 +262,14 @@ resource "aws_ecs_service" "service" {
262262 container_name = var. container_name != " " ? var. container_name : var. name_prefix
263263 }
264264 }
265+ dynamic "capacity_provider_strategy" {
266+ for_each = var. capacity_provider_strategy
267+ content {
268+ base = lookup (capacity_provider_strategy. value , " base" , null )
269+ capacity_provider = lookup (capacity_provider_strategy. value , " capacity_provider" , null )
270+ weight = lookup (capacity_provider_strategy. value , " weight" , null )
271+ }
272+ }
265273}
266274
267275# HACK: The workaround used in ecs/service does not work for some reason in this module, this fixes the following error:
Original file line number Diff line number Diff line change @@ -306,6 +306,12 @@ variable "volumes" {
306306 default = []
307307}
308308
309+ variable "capacity_provider_strategy" {
310+ description = " List capacity provider strategy"
311+ type = list (any )
312+ default = []
313+ }
314+
309315variable "extra_target_groups" {
310316 description = " List of extra target group configurations used to register a service to multiple target groups"
311317 type = list (object ({
You can’t perform that action at this time.
0 commit comments