-
Notifications
You must be signed in to change notification settings - Fork 433
Description
Current behavior
At the moment Copilot combines all addons related to a workload into a single CloudFormation stack, the AddonsStack.
Unfortunately, this limits the usability of addons, because circular dependencies are very easy to produce. Take the following use case with these 2 addons:
- I've got an S3 bucket, which I'd like to create as a workload addon. I'd like to pass the bucket's name to my Backend Service's ECS task. -> so the Copilot ECS Service depends on my addon (transitively). The dependency looks like this: the addon stack outputs the S3 bucket name, and the service references it via a
!Refadded by a cfn patch - I've got a CloudWatch alarm, which I'd use to monitor some metric on my ECS service, so I need the ECS Service's name to create this addon -> so my addon depends on the ECS Service. The dependency looks like this: via
addons.parameters.ymlI pass the!Refto the ECS Service down to the addon stack
Because my addons are collected to a single stack, being upstream and downstream to a Copilot resource is not possible:
Circular dependency between resources: [AddonsStack, Service, TaskDefinition]
Maybe there are some crazy workarounds, but I see the design choice as the main problem, that the addons are put into a single stack.
Desired behavior
Create one stack for every addon separately. This leaves more room for each addon, as it can be decided for each one of them, whether they depend on Copilot resources or vica versa.
Additional challenges
If this feature was to be implemented, it is going to be a challenge to migrate the current shared addon stacks to separated stacks. For productive applications it is presumably undesired to destroy the shared addon stack with all its resources and to create the new stacks, a smoother transition would be importing the old resources into the new stack and the deletion of the old stack without deleting the resources.
Related issues
- Circular depenceny with !Ref
Servicein addons.parameters.yml. #3149: very similar, but it went more into the direction of workarounds, with this issue I'd focus on the design decision to collect all addons into a single stack