Skip to content
Open
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 docker_autoscaler.tf
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ resource "aws_autoscaling_group" "autoscaler" {

content {
instances_distribution {
on_demand_allocation_strategy = var.runner_worker_docker_autoscaler_asg.on_demand_allocation_strategy
on_demand_base_capacity = var.runner_worker_docker_autoscaler_asg.on_demand_base_capacity
on_demand_percentage_above_base_capacity = var.runner_worker_docker_autoscaler_asg.on_demand_percentage_above_base_capacity
spot_allocation_strategy = var.runner_worker_docker_autoscaler_asg.spot_allocation_strategy
Expand Down
9 changes: 8 additions & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -813,9 +813,10 @@ variable "runner_worker_docker_autoscaler_asg" {
health_check_type = Controls how health checking is done. Values are - EC2 and ELB.
instance_refresh_min_healthy_percentage = The amount of capacity in the Auto Scaling group that must remain healthy during an instance refresh to allow the operation to continue, as a percentage of the desired capacity of the Auto Scaling group.
instance_refresh_triggers = Set of additional property names that will trigger an Instance Refresh. A refresh will always be triggered by a change in any of launch_configuration, launch_template, or mixed_instances_policy.
on_demand_allocation_strategy = Strategy for allocating on-demand instances. Valid values: 'prioritized' (by override order) or 'lowest-price'. Must be 'lowest-price' when instance_requirements is used — AWS rejects any other value with attribute-based instance selection. Defaults to 'lowest-price'.
on_demand_base_capacity = Absolute minimum amount of desired capacity that must be fulfilled by on-demand instances.
on_demand_percentage_above_base_capacity = Percentage split between on-demand and Spot instances above the base on-demand capacity.
spot_allocation_strategy = How to allocate capacity across the Spot pools. 'lowest-price' to optimize cost, 'capacity-optimized' to reduce interruptions.
spot_allocation_strategy = How to allocate capacity across the Spot pools. 'lowest-price' to optimize cost, 'capacity-optimized' to reduce interruptions, 'price-capacity-optimized' to balance both price and capacity availability (recommended for most workloads).
spot_instance_pools = Number of Spot pools per availability zone to allocate capacity. EC2 Auto Scaling selects the cheapest Spot pools and evenly allocates Spot capacity across the number of Spot pools that you specify.
subnet_ids = The list of subnet IDs to use for the Runner Worker when the fleet mode is enabled.
default_instance_type = Default instance type for the launch template
Expand All @@ -830,6 +831,7 @@ variable "runner_worker_docker_autoscaler_asg" {
health_check_type = optional(string, "EC2")
instance_refresh_min_healthy_percentage = optional(number, 90)
instance_refresh_triggers = optional(list(string), [])
on_demand_allocation_strategy = optional(string, "lowest-price")
on_demand_base_capacity = optional(number, 0)
on_demand_percentage_above_base_capacity = optional(number, 100)
spot_allocation_strategy = optional(string, "lowest-price")
Expand Down Expand Up @@ -857,6 +859,11 @@ variable "runner_worker_docker_autoscaler_asg" {
condition = length(var.runner_worker_docker_autoscaler_asg.types) == 0 || length(var.runner_worker_docker_autoscaler_asg.instance_requirements) == 0
error_message = "AWS does not allow setting both 'types' and 'instance_requirements' at the same time. Set only one."
}

validation {
condition = length(var.runner_worker_docker_autoscaler_asg.instance_requirements) == 0 || var.runner_worker_docker_autoscaler_asg.on_demand_allocation_strategy == "lowest-price"
error_message = "on_demand_allocation_strategy must be set to 'lowest-price' when instance_requirements is used — AWS rejects any other value with attribute-based instance selection."
}
}

variable "runner_worker_docker_machine_role" {
Expand Down
Loading