dougmoscrop / serverless-plugin-split-stacks

A plugin to generate nested stacks to get around CloudFormation resource/parameter/output limits
297 stars 68 forks source link

"Circular dependency between resources" when use lambda as cognito user pool trigger #53

Open JaderCM opened 5 years ago

JaderCM commented 5 years ago

This is not a bug, just a question. How can I deploy using the nested stacks by function but ignoring just a few functions?

I have a Cognito User Pool that uses lambda function to some triggers. Because all functions are separated into nested stacks, this causes circular dependency.

If these functions can be ignored to deploy in nested stacks, works.

It's possible to use "stacks-map.js" to ignore just some functions? Like that:

const FunctionsIgnoredToNestedStack = ["SyncCognitoWithDynamoDB"]
  .sort((name1, name2) => name2.length - name1.length);

const ignoredFunction = logicalId => FunctionsIgnoredToNestedStack
  .some(lambdaName => logicalId.startsWith(lambdaName));

const ServerlessPluginSplitStacks = require("serverless-plugin-split-stacks");

ServerlessPluginSplitStacks.resolveMigration = function(resource, logicalId, serverless) {
  return ignoredFunction(logicalId) ? { destination: "[WHAT_IS_THE_ROOT?]" } : null;
};
amitaymolko commented 5 years ago

Same issue, Were you able to get his working?

hoangsetup commented 5 years ago

Following PR https://github.com/dougmoscrop/serverless-plugin-split-stacks/pull/57