aws-cloudformation / cloudformation-coverage-roadmap

The AWS CloudFormation Public Coverage Roadmap
https://aws.amazon.com/cloudformation/
Creative Commons Attribution Share Alike 4.0 International
1.11k stars 54 forks source link

Attaching LoadBalancer TargetGroup to existing ECS::Service #1868

Closed wieshka closed 8 months ago

wieshka commented 8 months ago

Name of the resource

AWS::ECS::Service

Resource Name

No response

Issue Description

When you are attaching LoadBalancer to existing ECS::Service via Stack Update, despite having AWS::ElasticLoadBalancingV2::ListenerRule as DependsOn attribute, Stack Update will fail with The target group with targetGroupArn <ARN> does not have an associated load balancer.

Expected Behavior

I would expect, that Update and Create behaves the same, and Update does not introduce race condition.

Observed Behavior

Instead ECS::Service fails with The target group with targetGroupArn <ARN> does not have an associated load balancer.

Test Cases

Have a CloudFormation template which implements two ECS::Service's, one with LoadBalancers set on Create, other without. Make a following Update stack call, with extending second ECS::Service with LoadBalancers and it will fail even with ListenerRule listed on DependsOn.

Other Details

No response

wieshka commented 8 months ago

My bad on rushing to report bug, this has been identified as !Ref issue locally in template in rather complex Cloudformation stack with many Services & TargerGroups.