Skip to content

Commit 5e2942c

Browse files
committed
fix(capacity-provider): incorrect iteration for resource list outputs
1 parent 49576ec commit 5e2942c

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

modules/capacity-provider/main.tf

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,16 @@ resource "aws_ecs_capacity_provider" "this" {
3535
resource "aws_ecs_cluster_capacity_providers" "this" {
3636
cluster_name = var.ecs_cluster_name
3737

38-
capacity_providers = [for i in var.capacity_providers : element(var.capacity_providers, i).name]
38+
capacity_providers = [for capacity_provider in var.capacity_providers : capacity_provider.name]
3939

4040
dynamic "default_capacity_provider_strategy" {
4141
for_each = var.default_capacity_provider_strategies
42+
iterator = default_capacity_provider_strategies
4243

4344
content {
44-
capacity_provider = each.value.capacity_provider
45-
base = each.value.base
46-
weight = each.value.weight
45+
capacity_provider = default_capacity_provider_strategies.value.capacity_provider
46+
base = default_capacity_provider_strategies.value.base
47+
weight = default_capacity_provider_strategies.value.weight
4748
}
4849
}
4950
}

modules/capacity-provider/outputs.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44

55
output "ids" {
66
description = "Identifiers for the ECS Capacity Providers"
7-
value = [for i in aws_ecs_capacity_provider.this : aws_ecs_capacity_provider.this[i].id]
7+
value = [for ecs_capacity_provider in aws_ecs_capacity_provider.this : ecs_capacity_provider.id]
88
}
99

1010
output "arns" {
1111
description = "ARNs for the ECS Capacity Providers"
12-
value = [for i in aws_ecs_capacity_provider.this : aws_ecs_capacity_provider.this[i].arn]
12+
value = [for ecs_capacity_provider in aws_ecs_capacity_provider.this : ecs_capacity_provider.arn]
1313
}
1414

1515
################################################################################

0 commit comments

Comments
 (0)