Fazi
11/23/2021, 11:28 AMnpm run start
for debugging.
2. Dev B then clones the repo, and runs npm run start
, but this throws an error : table xyz already exists
What would be the best way around this?Ross Coundon
11/23/2021, 11:28 AMAram
11/23/2021, 11:29 AMFazi
11/23/2021, 11:41 AMGabriel Araújo
11/23/2021, 12:57 PMGabriel Araújo
11/23/2021, 12:58 PMthdxr
11/23/2021, 1:36 PMthdxr
11/23/2021, 1:37 PMFazi
11/23/2021, 1:43 PMthdxr
11/23/2021, 1:50 PMFazi
11/23/2021, 1:51 PMthdxr
11/23/2021, 2:06 PMclass TableStack extends sst.Stack {
public readonly table: sst.
constructor(scope) {
super(scope, "table")
if (scope.stage === "shared") {
this.table = new Table(...)
return
}
this.table = new sst.Table(this, "table", { dynamodbTable: dynamodb.Table.fromTableName(this, "Imported", "tablename") } )
}
thdxr
11/23/2021, 2:06 PM--stage shared
oncethdxr
11/23/2021, 2:06 PMFazi
11/23/2021, 2:31 PMJay
Stan
11/24/2021, 3:36 PMJay
Stan
11/24/2021, 4:01 PMthdxr
11/24/2021, 4:24 PMSeth Geoghegan
03/07/2022, 3:46 PMsst deploy --stage shared
) would deploy all the resources to a stage named shared
, which is not what I want
I can think of at least two ways to address this:
1. Only deploy the single stack to the shared environment (e.g. sst deploy <shared_stack_name> --stage shared
)
2. Apply the above conditional deploy logic to each resource created by your stack (probably a bad idea).
Sometimes I want to combine long-lived resources (e.g. dev/stage/prod) with ephemeral resources in my development environment. This is desirable when there is a non serverless piece of my architecture (e.g RDS, OpenSearch, etc).