Skip to content

Disable ECS AZ rebalancing so binpack placement applies - #264

Merged
ale210 merged 2 commits into
mainfrom
255-disable-az-rebalancing
Oct 10, 2026
Merged

ale210 merged 2 commits into
mainfrom
255-disable-az-rebalancing

Conversation

@ale210

@ale210 ale210 commented Oct 10, 2026

Copy link
Copy Markdown
Member

For #255. Fixes the failed apply from #263.

#263's apply rejected all ten ECS service updates: "Availability Zone Rebalancing only supports availability zone spread as task placement strategy." Every service has AZ rebalancing enabled, which allows only AZ-spread placement, so the new binpack was refused. The launch template change in the same apply succeeded (version 10, t3a.medium). The services were left untouched and still serve normally.

This sets availability_zone_rebalancing = "DISABLED" on aws_ecs_service. The cluster is one host in one Availability Zone, so there is nothing to rebalance across. Comments that cited AZ rebalancing as the reason deployment_maximum_percent stays at 200 now give the real reason: production starts its new task before stopping the old one.

Expected plan: 0 to add, 10 to change, 0 to destroy. Each ECS service is updated in place, with availability_zone_rebalancing going to DISABLED and the placement strategy going to binpack on memory.

The provider sends both changes in one UpdateService call. If ECS still rejects the placement because rebalancing has to be off first, the apply fails the same harmless way as #263's, and the fallback is a PR that changes only the rebalancing setting.

@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Terraform plan in terraform
With backend config files: terraform/prod.backend.tfvars

Plan: 0 to add, 10 to change, 0 to destroy.
Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
!~  update in-place

Terraform will perform the following actions:

  # module.civic-tech-index.module.backend_prod_service.aws_ecs_service.fargate[0] will be updated in-place
!~  resource "aws_ecs_service" "fargate" {
!~      availability_zone_rebalancing      = "ENABLED" -> "DISABLED"
        id                                 = "arn:aws:ecs:us-west-2:035866691871:service/incubator-prod/civic-tech-index-backend-prod"
        name                               = "civic-tech-index-backend-prod"
        tags                               = {
            "project" = "civic-tech-index"
        }
#        (18 unchanged attributes hidden)

!~      ordered_placement_strategy {
!~          field = "attribute:ecs.availability-zone" -> "memory"
!~          type  = "spread" -> "binpack"
        }
-       ordered_placement_strategy {
-           field = "instanceId" -> null
-           type  = "spread" -> null
        }

#        (4 unchanged blocks hidden)
    }

  # module.civic-tech-index.module.backend_stage_service.aws_ecs_service.fargate[0] will be updated in-place
!~  resource "aws_ecs_service" "fargate" {
!~      availability_zone_rebalancing      = "ENABLED" -> "DISABLED"
        id                                 = "arn:aws:ecs:us-west-2:035866691871:service/incubator-prod/civic-tech-index-backend-stage"
        name                               = "civic-tech-index-backend-stage"
        tags                               = {
            "project" = "civic-tech-index"
        }
#        (18 unchanged attributes hidden)

!~      ordered_placement_strategy {
!~          field = "attribute:ecs.availability-zone" -> "memory"
!~          type  = "spread" -> "binpack"
        }
-       ordered_placement_strategy {
-           field = "instanceId" -> null
-           type  = "spread" -> null
        }

#        (4 unchanged blocks hidden)
    }

  # module.civic-tech-jobs.module.civic_tech_jobs_fullstack_stage_service.aws_ecs_service.fargate[0] will be updated in-place
!~  resource "aws_ecs_service" "fargate" {
!~      availability_zone_rebalancing      = "ENABLED" -> "DISABLED"
        id                                 = "arn:aws:ecs:us-west-2:035866691871:service/incubator-prod/civic-tech-jobs-fullstack-stage"
        name                               = "civic-tech-jobs-fullstack-stage"
        tags                               = {
            "project" = "civic-tech-jobs"
        }
#        (18 unchanged attributes hidden)

!~      ordered_placement_strategy {
!~          field = "attribute:ecs.availability-zone" -> "memory"
!~          type  = "spread" -> "binpack"
        }
-       ordered_placement_strategy {
-           field = "instanceId" -> null
-           type  = "spread" -> null
        }

#        (4 unchanged blocks hidden)
    }

  # module.home-unite-us.module.prod_service.aws_ecs_service.fargate[0] will be updated in-place
!~  resource "aws_ecs_service" "fargate" {
!~      availability_zone_rebalancing      = "ENABLED" -> "DISABLED"
        id                                 = "arn:aws:ecs:us-west-2:035866691871:service/incubator-prod/home-unite-us-fullstack-prod"
        name                               = "home-unite-us-fullstack-prod"
        tags                               = {
            "project" = "home-unite-us"
        }
#        (18 unchanged attributes hidden)

!~      ordered_placement_strategy {
!~          field = "attribute:ecs.availability-zone" -> "memory"
!~          type  = "spread" -> "binpack"
        }
-       ordered_placement_strategy {
-           field = "instanceId" -> null
-           type  = "spread" -> null
        }

#        (4 unchanged blocks hidden)
    }

  # module.home-unite-us.module.qa_service.aws_ecs_service.fargate[0] will be updated in-place
!~  resource "aws_ecs_service" "fargate" {
!~      availability_zone_rebalancing      = "ENABLED" -> "DISABLED"
        id                                 = "arn:aws:ecs:us-west-2:035866691871:service/incubator-prod/home-unite-us-fullstack-qa"
        name                               = "home-unite-us-fullstack-qa"
        tags                               = {
            "project" = "home-unite-us"
        }
#        (18 unchanged attributes hidden)

!~      ordered_placement_strategy {
!~          field = "attribute:ecs.availability-zone" -> "memory"
!~          type  = "spread" -> "binpack"
        }
-       ordered_placement_strategy {
-           field = "instanceId" -> null
-           type  = "spread" -> null
        }

#        (4 unchanged blocks hidden)
    }

  # module.people-depot.module.backend_dev_service.aws_ecs_service.fargate[0] will be updated in-place
!~  resource "aws_ecs_service" "fargate" {
!~      availability_zone_rebalancing      = "ENABLED" -> "DISABLED"
        id                                 = "arn:aws:ecs:us-west-2:035866691871:service/incubator-prod/people-depot-backend-dev"
        name                               = "people-depot-backend-dev"
        tags                               = {
            "project" = "people-depot"
        }
#        (18 unchanged attributes hidden)

!~      ordered_placement_strategy {
!~          field = "attribute:ecs.availability-zone" -> "memory"
!~          type  = "spread" -> "binpack"
        }
-       ordered_placement_strategy {
-           field = "instanceId" -> null
-           type  = "spread" -> null
        }

#        (4 unchanged blocks hidden)
    }

  # module.vrms.module.backend_dev_service.aws_ecs_service.fargate[0] will be updated in-place
!~  resource "aws_ecs_service" "fargate" {
!~      availability_zone_rebalancing      = "ENABLED" -> "DISABLED"
        id                                 = "arn:aws:ecs:us-west-2:035866691871:service/incubator-prod/vrms-backend-dev"
        name                               = "vrms-backend-dev"
        tags                               = {
            "project" = "vrms"
        }
#        (18 unchanged attributes hidden)

!~      ordered_placement_strategy {
!~          field = "attribute:ecs.availability-zone" -> "memory"
!~          type  = "spread" -> "binpack"
        }
-       ordered_placement_strategy {
-           field = "instanceId" -> null
-           type  = "spread" -> null
        }

#        (4 unchanged blocks hidden)
    }

  # module.vrms.module.backend_prod_service.aws_ecs_service.fargate[0] will be updated in-place
!~  resource "aws_ecs_service" "fargate" {
!~      availability_zone_rebalancing      = "ENABLED" -> "DISABLED"
        id                                 = "arn:aws:ecs:us-west-2:035866691871:service/incubator-prod/vrms-backend-prod"
        name                               = "vrms-backend-prod"
        tags                               = {
            "project" = "vrms"
        }
#        (18 unchanged attributes hidden)

!~      ordered_placement_strategy {
!~          field = "attribute:ecs.availability-zone" -> "memory"
!~          type  = "spread" -> "binpack"
        }
-       ordered_placement_strategy {
-           field = "instanceId" -> null
-           type  = "spread" -> null
        }

#        (4 unchanged blocks hidden)
    }

  # module.vrms.module.frontend_dev_service.aws_ecs_service.fargate[0] will be updated in-place
!~  resource "aws_ecs_service" "fargate" {
!~      availability_zone_rebalancing      = "ENABLED" -> "DISABLED"
        id                                 = "arn:aws:ecs:us-west-2:035866691871:service/incubator-prod/vrms-frontend-dev"
        name                               = "vrms-frontend-dev"
        tags                               = {
            "project" = "vrms"
        }
#        (18 unchanged attributes hidden)

!~      ordered_placement_strategy {
!~          field = "attribute:ecs.availability-zone" -> "memory"
!~          type  = "spread" -> "binpack"
        }
-       ordered_placement_strategy {
-           field = "instanceId" -> null
-           type  = "spread" -> null
        }

#        (4 unchanged blocks hidden)
    }

  # module.vrms.module.frontend_prod_service.aws_ecs_service.fargate[0] will be updated in-place
!~  resource "aws_ecs_service" "fargate" {
!~      availability_zone_rebalancing      = "ENABLED" -> "DISABLED"
        id                                 = "arn:aws:ecs:us-west-2:035866691871:service/incubator-prod/vrms-frontend-prod"
        name                               = "vrms-frontend-prod"
        tags                               = {
            "project" = "vrms"
        }
#        (18 unchanged attributes hidden)

!~      ordered_placement_strategy {
!~          field = "attribute:ecs.availability-zone" -> "memory"
!~          type  = "spread" -> "binpack"
        }
-       ordered_placement_strategy {
-           field = "instanceId" -> null
-           type  = "spread" -> null
        }

#        (4 unchanged blocks hidden)
    }

Plan: 0 to add, 10 to change, 0 to destroy.

✅ Plan applied in Terraform apply (OIDC) #105

@ale210
ale210 merged commit 106c853 into main Oct 10, 2026
@ale210 ale210 mentioned this pull request Oct 10, 2026
6 of 7 tasks
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.

1 participant