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

Allow setting instance weights for autoscaling #1701

Closed
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 locals.tf
Original file line number Diff line number Diff line change
@@ -103,6 +103,7 @@ locals {
metadata_http_put_response_hop_limit = null # The desired HTTP PUT response hop limit for instance metadata requests.
# Settings for launch templates with mixed instances policy
override_instance_types = ["m5.large", "m5a.large", "m5d.large", "m5ad.large"] # A list of override instance types for mixed instances policy
instance_type_weights = {} # A map of instance types to their respective weights. You can use this to make a 2xlarge instance provide 2 instances while an xlarge instance only provides 1. If omitted, 1 will be used.
on_demand_allocation_strategy = null # Strategy to use when launching on-demand instances. Valid values: prioritized.
on_demand_base_capacity = "0" # Absolute minimum amount of desired capacity that must be fulfilled by on-demand instances
on_demand_percentage_above_base_capacity = "0" # Percentage split between on-demand and Spot instances above the base on-demand capacity
3 changes: 2 additions & 1 deletion workers_launch_template.tf
Original file line number Diff line number Diff line change
@@ -165,7 +165,8 @@ resource "aws_autoscaling_group" "workers_launch_template" {
)

content {
instance_type = override.value
instance_type = override.value
weighted_capacity = tostring(lookup(lookup(var.worker_groups_launch_template[count.index], "instance_type_weights", {}), override.value, "1"))
}
}
}