terraform-aws-ecs icon indicating copy to clipboard operation
terraform-aws-ecs copied to clipboard

`examples/complete` -- advancedConfiguration field is required for all loadBalancers when using the linear deployment strategy

Open setheliot opened this issue 1 week ago β€’ 0 comments

Description

On clean (new) install (terraform apply) of examples/complete, it fails with this error:

β”‚ Error: creating ECS Service (ecsdemo-frontend): operation error ECS: CreateService, https response error StatusCode: 400, RequestID: c56fde76-8bdf-4d23-8853-e225514c57cf, ClientException: advancedConfiguration field is required for all loadBalancers when using the linear deployment strategy
β”‚
β”‚   with module.ecs.module.service["ecsdemo-frontend"].aws_ecs_service.this[0],
β”‚   on ../../modules/service/main.tf line 39, in resource "aws_ecs_service" "this":
β”‚   39: resource "aws_ecs_service" "this" {

I think this was introduced in https://github.com/terraform-aws-modules/terraform-aws-ecs/pull/371

The following may be the correct solution, but I have not implemented it / tried it

The load_balancer block should include advanced_configuration as shown in examples/fargate/main.tf:

  load_balancer = {
    service = {
      target_group_arn = module.alb.target_groups["ex_ecs"].arn
      container_name   = local.container_name
      container_port   = local.container_port

      advanced_configuration = {
        alternate_target_group_arn = module.alb.target_groups["ex_ecs_alternate"].arn
        production_listener_rule   = module.alb.listener_rules["ex_http/production"].arn
        test_listener_rule         = module.alb.listener_rules["ex_http/test"].arn
        role_arn                   = aws_iam_role.ecs_elb_permissions.arn
      }
    }
  }

This also requires:

  • An alternate target group in the ALB module

  • Production and test listener rules

  • IAM role with ECS ELB permissions (see examples/fargate/main.tf lines 447-475)

  • [x] βœ‹ I have searched the open/closed issues and my issue is not listed.

⚠️ Note

Before you submit an issue, please perform the following first:

  1. Remove the local .terraform directory (! ONLY if state is stored remotely, which hopefully you are following that best practice!): rm -rf .terraform/
  2. Re-initialize the project root to pull down modules: terraform init
  3. Re-attempt your terraform plan or apply and check if the issue still persists

Versions

  • Module version [Required]: 6.10.0

  • Terraform version: v1.14.2

  • Provider version(s): AWS Provider: v6.26.0
cd terraform-aws-ecs/examples/complete
terraform init
terraform apply

Are you using workspaces: No

Have you cleared the local cache (see Notice section above)?: Yes

Expected behavior

Actual behavior

Terminal Output Screenshot(s)

Additional context

setheliot avatar Dec 12 '25 19:12 setheliot