Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Converting type of default_capacity_provider_strategy from map to list #28

Merged
merged 4 commits into from
Jan 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
terraform.tfstate
*.tfstate*
terraform.tfvars
.terraform.lock.hcl
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ module "ecs" {

capacity_providers = ["FARGATE", "FARGATE_SPOT"]

default_capacity_provider_strategy = {
capacity_provider = "FARGATE_SPOT"
}
default_capacity_provider_strategy = [
{
capacity_provider = "FARGATE_SPOT"
}
]

tags = {
Environment = "Development"
Expand Down Expand Up @@ -77,7 +79,7 @@ module "ecs" {
| 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 |
| container\_insights | Controls if ECS Cluster has container insights enabled | `bool` | `false` | no |
| create\_ecs | Controls if ECS should be created | `bool` | `true` | no |
| default\_capacity\_provider\_strategy | The capacity provider strategy to use by default for the cluster. Can be one or more. | `map(any)` | `{}` | no |
| default\_capacity\_provider\_strategy | The capacity provider strategy to use by default for the cluster. Can be one or more. | `list(map(any))` | `[]` | no |
| name | Name to be used on all the resources as identifier, also the name of the ECS cluster | `string` | `null` | no |
| tags | A map of tags to add to ECS Cluster | `map(string)` | `{}` | no |

Expand Down
4 changes: 2 additions & 2 deletions examples/complete-ecs/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ module "ecs" {

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

default_capacity_provider_strategy = {
default_capacity_provider_strategy = [{
capacity_provider = aws_ecs_capacity_provider.prov1.name # "FARGATE_SPOT"
}
}]

tags = {
Environment = local.environment
Expand Down
4 changes: 2 additions & 2 deletions examples/complete-ecs/service-hello-world/versions.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
terraform {
required_version = ">= 0.12.6, < 0.14"
required_version = ">= 0.12.6"

required_providers {
aws = ">= 2.0, < 4.0"
aws = ">= 2.0"
}
}
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ resource "aws_ecs_cluster" "this" {
capacity_providers = var.capacity_providers

dynamic "default_capacity_provider_strategy" {
for_each = length(keys(var.default_capacity_provider_strategy)) == 0 ? [] : [var.default_capacity_provider_strategy]
for_each = var.default_capacity_provider_strategy
iterator = strategy

content {
Expand Down
4 changes: 2 additions & 2 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ variable "capacity_providers" {

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

variable "container_insights" {
Expand Down