(aws_ecs_patterns): ApplicationLoadBalancedFargateService fails to update when switched from public to private - Fails due to target group #33253
Labels
@aws-cdk/aws-ecs-patterns
Related to ecs-patterns library
bug
This issue is a bug.
needs-triage
This issue or PR still needs to be triaged.
Describe the bug
When the ApplicationLoadBalancedFargateService pattern is used to create an ALB along with a target group, it creates a public facing load balancer. Once this is created, if I try to switch it to a private ALB, using the parameter
publicLoadBalancer: false
, it fails with error:Resource handler returned message: "The following target groups cannot be associated with more than one load balancer: arn:aws:elasticloadbalancing:eu-west-1:318627068478:targetgroup/EcsCon-Sampl-HV24A4ZHHGG1/829e923a9abe6705 (Service: ElasticLoadBalancingV2, Status Code: 400, Request ID: dbe30509-a4b7-42fa-9087-bcff22fdb55b)" (RequestToken: 544175ba-248a-5a75-3458-50b0f5d80582, HandlerErrorCode: ServiceLimitExceeded)
Regression Issue
Last Known Working CDK Version
No response
Expected Behavior
The target group should be disassociated from the previous load balancer and then attempted to be attached to the new load balancer or a new target group could be created to attach to the new load balancer.
Here's the CDK diff:
Current Behavior
Stack deployment fails because the target group is not attached to the private load balancer since it is already attached to the public load balancer
Reproduction Steps
Create an application load balanced fargate service using the construct as follows:
Simply add the
publicLoadBalancer: false
to the construct ApplicationLoadBalancedFargateService as follows:Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
v2.177.0
Framework Version
No response
Node.js Version
v20.17.0
OS
Windows
Language
TypeScript
Language Version
No response
Other information
No response
The text was updated successfully, but these errors were encountered: