Skip to content

Conversation

@BCTBB
Copy link
Contributor

@BCTBB BCTBB commented Oct 3, 2025

  • Adds support for CAPACITY_MAX="${MAX_CAPACITY}", if scaling up. CAPACITY_MAX = 0, if scaling down.
  • Adds support for --max-capacity in the ${ADJUST_AUTOSCALING} logic

@rfairburn
Copy link
Contributor

If we are adding a new max capacity, then it needs to be passed in as a new variable to the module:

module "migrations" {
  source                   = "github.com/fleetdm/fleet-terraform/addons/migrations?depth=1&ref=tf-mod-addon-migrations-v2.1.0"
  ecs_cluster              = module.fleet.byo-vpc.byo-db.byo-ecs.service.cluster
  task_definition          = module.fleet.byo-vpc.byo-db.byo-ecs.task_definition.family
  task_definition_revision = module.fleet.byo-vpc.byo-db.byo-ecs.task_definition.revision
  subnets                  = module.fleet.byo-vpc.byo-db.byo-ecs.service.network_configuration[0].subnets
  security_groups          = module.fleet.byo-vpc.byo-db.byo-ecs.service.network_configuration[0].security_groups
  ecs_service              = module.fleet.byo-vpc.byo-db.byo-ecs.service.name
  desired_count            = module.fleet.byo-vpc.byo-db.byo-ecs.appautoscaling_target.min_capacity
  min_capacity             = module.fleet.byo-vpc.byo-db.byo-ecs.appautoscaling_target.min_capacity
  max_capacity            = module.fleet.byo-vpc.byo-db.byo-ecs.appautoscaling_target.max_capcity
  depends_on = [
    module.fleet, 
  ] 
} 

Then we roll that into the script from terraform and work with it. Otherwise, when we scale back up, we don't have our original max capacity from terraform.

If I am missing something here, please let me know, but I think the pr as is will cap the upper-end capacity lower than we want after scale-up.

@BCTBB
Copy link
Contributor Author

BCTBB commented Oct 3, 2025

I was leveraging ${COUNT} which looks tied to the ${DESIRED_COUNT} to drive the behavior for the --max-capacity, so that expected behavior is driven by the correctly labeled input.

@BCTBB BCTBB marked this pull request as draft October 3, 2025 20:34
@BCTBB BCTBB marked this pull request as ready for review October 23, 2025 19:25
@BCTBB BCTBB merged commit fc25a69 into main Oct 24, 2025
2 checks passed
@BCTBB BCTBB deleted the migrations-updates branch October 24, 2025 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants