SST right now seems to create the CloudFormation s...
# help
d
SST right now seems to create the CloudFormation stacks named this way…
[stage]-[sst.json name]-[stack instance name]
However, we have a stack naming convention we like to follow that we want to be
[service]-[stage]
Eg. service = my-app stage = dev // my-app-dev Is there a way to override the SST stackname?
a
I was using same convention.
But I would recommend to move to the standard one.
Due SST is designed to have X amount of environments, one for developer or PR.
This standard convention works better for that.
d
It might be the place we eventually move to, but we have a number of services that rely on this stack naming convention. Is there any way to override?
Our format is the same as serverless frameworks and “stage” is synonymous with “environment” of which you can also have many of without collisions
f
Hey Dan, can you try this?
Copy code
new MyStack(app, "my-stack", {
  stackName: `my-stack-${app.stage}`,
});
c
unfortnately I got an error saying
Copy code
Error: Stack (my-stack-dev) is not prefixed with the stage. Use sst.Stack or the format {stageName}-my-stack-dev.
@Frank I guess there is some checking that is happening to prevent changing the format to not be prefixed with stage?
f
Oh right! @Camilo Bravo sorry about that. We should definitely allow this. Lemme talk to the team and get back to you.
Just to clarify, by
[service]-[stage]
did @Dan Van Brunt mean
[stack instance name]-[stage]
?
So if your
lib/index.js
looked like this:
Copy code
new ApiStack(app, "api");
You want to name the stack
api-dev
, correct?
c
exactly @Frank thats right
f
Got it! Will follow up on this.
@Camilo Bravo @Dan Van Brunt I just opened an issue with the proposed solution https://github.com/serverless-stack/serverless-stack/issues/849
We will change it to allow stack name starts with
[stage]-
, ends in
-[stage]
, or contains
-[stage]-
. It just has to be parameterized with the stage name, at least for now.
That should work for u guys right?
c
yeah that will work for us
f
sounds good!
d
@Frank any idea if anyone will pick this one up soon? https://github.com/serverless-stack/serverless-stack/issues/849 We’re close to needing it now. If not, I’ll take a peak tonight/tomorrow.
f
Hey @Dan Van Brunt, I can take a look at this today!
Hey @Dan Van Brunt @Camilo Bravo, release v0.46.0 has got the changes above. Give it a try and let me know if it works for you guys!