diff --git a/_variables.tf b/_variables.tf index 3d9a53c..5cff8e7 100644 --- a/_variables.tf +++ b/_variables.tf @@ -34,6 +34,12 @@ variable "on_demand_base_capacity" { default = 0 } +variable "spot_allocation_strategy" { + type = string + default = "price-capacity-optimized" + description = "How to allocate capacity across the Spot pools. Valid values: lowest-price, diversified, capacity-optimized, price-capacity-optimized." +} + variable "vpc_id" { description = "VPC ID to deploy the ECS cluster." } diff --git a/asg.tf b/asg.tf index a7f2f2b..185468c 100644 --- a/asg.tf +++ b/asg.tf @@ -18,7 +18,7 @@ resource "aws_autoscaling_group" "ecs" { } instances_distribution { - spot_instance_pools = 3 + spot_allocation_strategy = var.spot_allocation_strategy on_demand_base_capacity = var.on_demand_base_capacity on_demand_percentage_above_base_capacity = var.on_demand_percentage }