Fix ECSService sometimes failing to create #796
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.