Skip to content

Commit

Permalink
Merge pull request #15 from AndreyMulin/master
Browse files Browse the repository at this point in the history
default_capacity_provider_strategy setting depends on variable
  • Loading branch information
sugdyzhekov authored Jul 7, 2023
2 parents de0e907 + 06438e6 commit 6da0f25
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
11 changes: 7 additions & 4 deletions ecs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ resource "aws_ecs_cluster_capacity_providers" "example" {

capacity_providers = [aws_ecs_capacity_provider.asg.name]

default_capacity_provider_strategy {
base = 1
weight = 100
capacity_provider = aws_ecs_capacity_provider.asg.name
dynamic "default_capacity_provider_strategy" {
for_each = var.enabled_default_capacity_provider ? [1] : []
content {
base = 1
weight = 100
capacity_provider = aws_ecs_capacity_provider.asg.name
}
}
}

Expand Down
9 changes: 7 additions & 2 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ variable "trusted_cidr_blocks" {
variable "instance_types" {
description = "ECS node instance types. Maps of pairs like `type = weight`. Where weight gives the instance type a proportional weight to other instance types."
type = map(any)
default = {
default = {
"t3a.small" = 2
}
}
Expand Down Expand Up @@ -70,7 +70,7 @@ variable "on_demand_base_capacity" {

variable "lifecycle_hooks" {
description = "A list of lifecycle hook actions. See details at https://docs.aws.amazon.com/autoscaling/ec2/userguide/lifecycle-hooks.html."
type = list(object({
type = list(object({
name = string
lifecycle_transition = string
default_result = string
Expand All @@ -88,6 +88,11 @@ variable "arm64" {
default = false
}

variable "enabled_default_capacity_provider" {
type = bool
default = true
}

data "aws_subnet" "default" {
id = local.subnets_ids[0]
}
Expand Down

0 comments on commit 6da0f25

Please sign in to comment.