Skip to content

Commit da8126f

Browse files
Use only the defined default capacity provider strategies.
An ECS Cluster can have up to 4 default capacity provider strategies. The previous logic would add every capacity provider defined for either EC2 or Fargate. Update the logic to only set a default strategy if the capacity provider sets the default_capacity_provider_strategy map.
1 parent bf5bdcd commit da8126f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

modules/cluster/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ resource "aws_cloudwatch_log_group" "this" {
109109

110110
locals {
111111
default_capacity_providers = merge(
112-
{ for k, v in var.fargate_capacity_providers : k => v if var.default_capacity_provider_use_fargate },
113-
{ for k, v in var.autoscaling_capacity_providers : k => v if !var.default_capacity_provider_use_fargate }
112+
{ for k, v in var.fargate_capacity_providers : k => v if var.default_capacity_provider_use_fargate && lookup(v, "default_capacity_provider_strategy", null) != null },
113+
{ for k, v in var.autoscaling_capacity_providers : k => v if !var.default_capacity_provider_use_fargate && lookup(v, "default_capacity_provider_strategy", null) != null }
114114
)
115115
}
116116

0 commit comments

Comments
 (0)