-
Notifications
You must be signed in to change notification settings - Fork 11
Description
Steps to reproduce
Create SLS app with 2 stacks. For example:
stack 1
export function Stack1({ stack }: StackContext) {
const dynamoDbTable = new Table(stack, "SomeDynamoDbTable", {
fields: {
pk: "string",
sk: "string"
},
primaryIndex: { partitionKey: "pk", sortKey: "sk" },
});
return {
dynamoDbTable,
}
}stack 2 (dependant on stack1)
export function Stack2({ stack }: StackContext) {
const { dynamoDbTable } = use(Stack1);
const myFx = new Function(stack, "MyFx", {
handler: "packages/functions/src/s3/my-fx.handler",
environment: {
DDB_TABLE_NAME: dynamoDbTable,
},
});
}Import the stacks together in sst.config.ts
export default {
config(_input) {
return {
name: process.env.SST_APP_NAME!,
region: process.env.AWS_LAMBDAS_REGION!,
};
},
stacks(app) {
if (app.stage !== "prod") {
app.setDefaultRemovalPolicy(RemovalPolicy.DESTROY);
}
const stackNamePrefix = `${app.name}-${app.stage}`;
app.stack(Stack1, { stackName: `${stackNamePrefix}-Stack1` });
app.stack(Stack2, { stackName: `${stackNamePrefix}-Stack2` });
}
} satisfies SSTConfig;Now setup Seed to deploy the SLS stacks on every PR, like below:
Current behaviour
- Stack is created correctly when PR is created, Seed correctly handles deploying first
Stack1, nextStack2. - When PR is closed, only
Stack2is deleted,Stack1is not because of the below error (for some reason Seed wants to delete them 2 simultaneously, rather than one by one)
(on the below screenshot SfStack is Stack2 from our example above (dependant), while MyStack is Stack1 from the example)
Expected behaviour
- When PR is closed, Seed deletes dependant stacks one by one, not all of them at once
Stack
- Seed is instructed to use node in version 16.14.2 - there is nothing more in
seed.ymlother than thatn 16.14.2inbefore_compilestage - SST version: 2.1.26
I know that there is a possibility to configure deploy phases, however, when I have 2 stacks defined as above in one sst.config.ts, I see that there is no way to distinguish these 2 as separate stacks in Seed. Is there a way to do it like that or if I want to use seed and keep the dependencies between stacks, I should have a separate service as a different SST project (with its own custom directory in my monorepo and sst.config.ts) to make it work like that?
PS1: I am aware that this issue is submitted in seed-run/homepage repository, however, I couldn't find better place to submit this issue.
PS2: When deleting the stacks via SST (npx sst remove), this problem doesn't occur, i.e. SST honours the dependencies between stacks properly.

