degica / barcelona

PaaS built on top of AWS
MIT License
52 stars 6 forks source link

Fix ECSService sometimes failing to create #796

Closed davidsiaw closed 1 year ago

davidsiaw commented 1 year ago

ECSService sometimes fails to create when a reviewapp is being deployed. This creates a lot of headaches because barcelona does not return an error when the deploy is requested and it takes inspecting cloudformation to check what is happening.

This is primarily caused by https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html#aws-resource-ecs-service--examples (in the Associate an Application Load Balancer with a service section). In CF the parallel resource creation creates a race condition for the preparation of the Listener

However in our stack, the listener already exists. The difference here is that the Listener rules have not been created yet, and that causes the issue.

The fix here is to force the ECSService to depend on the creation of listener rules.

degikko commented 1 year ago

@essa can you help us review this PR, please?