dougmoscrop/serverless-plugin-split-stacks

stackConcurrency circular dependency

carlcheel-sage opened this issue · 1 comments

In order to avoid API limits when deploying lambda functions (without splitting into multiple serverless.yml files) I've set the stackConcurrency option.

However this is adding a dependsOn parameter to a nestedStack that is creating a circular dependency. Like so: stack1 > stack2 > stack3 > stack1. A couple of potential fixes:

  1. Add advanced logic when splitting the stacks by stackConcurrency. Check for circular dependencies and only apply the dependsOn when possible.

  2. Allow the user to manually specify which stack depends on which. In my use case, I only want each of the lambda function stacks to depend on one another. Potentially as simple as adding a config option like so:

custom:
  splitStacks:
    dependsOn:
      stack1: stack2
      stack2: stack3
      ...

Option 2 would be ideal for my use case, do you have any thoughts on this?

Added PR for your consideration. Can confirm it works fine for my use case and believe this will help other users too.