Skip to content

Commit 1e2c324

Browse files
authored
feat: Add capacity_rebalance support for self-managed worker groups (#1326)
1 parent bf4fd83 commit 1e2c324

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

local.tf

+1
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ locals {
127127
instance_refresh_min_healthy_percentage = 90 # The amount of capacity in the ASG that must remain healthy during an instance refresh, as a percentage of the ASG's desired capacity.
128128
instance_refresh_instance_warmup = null # The number of seconds until a newly launched instance is configured and ready to use. Defaults to the ASG's health check grace period.
129129
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.
130+
capacity_rebalance = false # Enable capacity rebalance
130131
}
131132

132133
workers_group_defaults = merge(

workers.tf

+5
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,11 @@ resource "aws_autoscaling_group" "workers" {
9797
"health_check_grace_period",
9898
local.workers_group_defaults["health_check_grace_period"]
9999
)
100+
capacity_rebalance = lookup(
101+
var.worker_groups[count.index],
102+
"capacity_rebalance",
103+
local.workers_group_defaults["capacity_rebalance"]
104+
)
100105

101106
dynamic "initial_lifecycle_hook" {
102107
for_each = var.worker_create_initial_lifecycle_hooks ? lookup(var.worker_groups[count.index], "asg_initial_lifecycle_hooks", local.workers_group_defaults["asg_initial_lifecycle_hooks"]) : []

workers_launch_template.tf

+5
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@ resource "aws_autoscaling_group" "workers_launch_template" {
9696
"health_check_grace_period",
9797
local.workers_group_defaults["health_check_grace_period"]
9898
)
99+
capacity_rebalance = lookup(
100+
var.worker_groups_launch_template[count.index],
101+
"capacity_rebalance",
102+
local.workers_group_defaults["capacity_rebalance"]
103+
)
99104

100105
dynamic "mixed_instances_policy" {
101106
iterator = item

0 commit comments

Comments
 (0)