Building release packages for test and production environment

Hi,

In the current project, I introduced the Serverless Framework as a main infrastructure deployment tool. Our release process requires that package first must be deployed to the test environment and after successful verification deployed on the production environment.

But, those environments use a few different parameters like a domain name or API key. Those parameters are populated during package build what means that they are hardcoded by the SLS into the CloudFormation template.
e.g.
{self:custom.stages.{self:provider.stage}.apiKey, self:custom.stages.dev.apiKey}

Right now we are building two separate packages. One for test and one for prod environment, but I don’t allow to fully confirm that production package is working as expected.

Any ideas about how to resolve it and deploy the same package to both environments?

1 Like

Having the same question myself. Serverless makes it easy to deploy to different stages, but this creates a whole new stack, so it doesn’t seem like there’s a way to setup a test/staging stack and then “push/promote” that stack to prod, we just have to do a new sls deploy command with the prod environment set, but this method doesn’t guarantee an identical stack…