Skip to content

Commit 44670f5

Browse files
fix: Converting type of default_capacity_provider_strategy from map to list (#28)
1 parent d7e95b6 commit 44670f5

File tree

6 files changed

+14
-11
lines changed

6 files changed

+14
-11
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
terraform.tfstate
33
*.tfstate*
44
terraform.tfvars
5+
.terraform.lock.hcl

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,11 @@ module "ecs" {
2727
2828
capacity_providers = ["FARGATE", "FARGATE_SPOT"]
2929
30-
default_capacity_provider_strategy = {
31-
capacity_provider = "FARGATE_SPOT"
32-
}
30+
default_capacity_provider_strategy = [
31+
{
32+
capacity_provider = "FARGATE_SPOT"
33+
}
34+
]
3335
3436
tags = {
3537
Environment = "Development"
@@ -77,7 +79,7 @@ module "ecs" {
7779
| capacity\_providers | List of short names of one or more capacity providers to associate with the cluster. Valid values also include FARGATE and FARGATE\_SPOT. | `list(string)` | `[]` | no |
7880
| container\_insights | Controls if ECS Cluster has container insights enabled | `bool` | `false` | no |
7981
| create\_ecs | Controls if ECS should be created | `bool` | `true` | no |
80-
| default\_capacity\_provider\_strategy | The capacity provider strategy to use by default for the cluster. Can be one or more. | `map(any)` | `{}` | no |
82+
| default\_capacity\_provider\_strategy | The capacity provider strategy to use by default for the cluster. Can be one or more. | `list(map(any))` | `[]` | no |
8183
| name | Name to be used on all the resources as identifier, also the name of the ECS cluster | `string` | `null` | no |
8284
| tags | A map of tags to add to ECS Cluster | `map(string)` | `{}` | no |
8385

examples/complete-ecs/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ module "ecs" {
3939

4040
capacity_providers = ["FARGATE", "FARGATE_SPOT", aws_ecs_capacity_provider.prov1.name]
4141

42-
default_capacity_provider_strategy = {
42+
default_capacity_provider_strategy = [{
4343
capacity_provider = aws_ecs_capacity_provider.prov1.name # "FARGATE_SPOT"
44-
}
44+
}]
4545

4646
tags = {
4747
Environment = local.environment
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
terraform {
2-
required_version = ">= 0.12.6, < 0.14"
2+
required_version = ">= 0.12.6"
33

44
required_providers {
5-
aws = ">= 2.0, < 4.0"
5+
aws = ">= 2.0"
66
}
77
}

main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ resource "aws_ecs_cluster" "this" {
66
capacity_providers = var.capacity_providers
77

88
dynamic "default_capacity_provider_strategy" {
9-
for_each = length(keys(var.default_capacity_provider_strategy)) == 0 ? [] : [var.default_capacity_provider_strategy]
9+
for_each = var.default_capacity_provider_strategy
1010
iterator = strategy
1111

1212
content {

variables.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ variable "capacity_providers" {
1818

1919
variable "default_capacity_provider_strategy" {
2020
description = "The capacity provider strategy to use by default for the cluster. Can be one or more."
21-
type = map(any)
22-
default = {}
21+
type = list(map(any))
22+
default = []
2323
}
2424

2525
variable "container_insights" {

0 commit comments

Comments
 (0)