serverless-plugin-additional-stacks icon indicating copy to clipboard operation
serverless-plugin-additional-stacks copied to clipboard

Remove additional stacks in reverse order

Open thomasviaud opened this issue 5 years ago • 2 comments

Hi,

Imagine I have 2 additional stacks in my project : apiGatewayStack & cognitoStack. My cognitoStack needs apiGateway values in order to be setup. That's why i'm declaring apiGatewayStack before cognitoStack (I'm exporting values in the first stack).

When I need to delete all my additionalStacks the order is the same so it will try to delete apiGatewayStack first and then cognito. The problem is the delete of the apiGatewayStack won't work because some values are used in cognitoStack.

Should we just delete additional stacks in reverse order to avoid such problems ?

thomasviaud avatar Feb 05 '20 11:02 thomasviaud

It sounds like reverse deleting would be a good idea. Even though multiple stacks are supported, I have used only one additional stack for all permanent data of the service (DynamoDB tables etc) so I have not encountered this issue personally.

kennu avatar Feb 05 '20 11:02 kennu

Agree. I like to use different stacks to isolate DynamoDB, Cognito, ApiGateway, IAM, ... stuff. It is easier to redeploy some parts.

I'll submit a PR with the change asap. Thanks.

thomasviaud avatar Feb 05 '20 11:02 thomasviaud