Allow explicitly specifying `serverless.yml` file in CLI options or env var
See original GitHub issueThis is a (Feature Proposal)
Description
For bug reports:
- What went wrong?
- What did you expect should have happened?
- What was the config you used?
- What stacktrace or error message from your provider did you see?
For feature proposals:
- What is the use case that should be solved. The more detail you describe this in the easier it is to understand for us.
I’d like to make different deployments in dev/stage/prod environments, and I need to include or exclude certain config blocks conditionally in serverless.yml
, which is not supported by now.
Instead of implementing conditional logic into serverless.yml
, a simpler way is to allow the CLI accepts an explicit ‘-f’ option, or an env var, then we could put different configs in serverless.dev.yml
and serverless.prod.yml
, etc.
Or even better, the main serverless.yml
file is always taken and user could specify extra config files to be merged with the main config, like how docker-compose -f
works.
- If there is additional config how would it look
Similar or dependent issues: None
Additional Data
- Serverless Framework Version you’re using: 1.24.1
- Operating System:
- Stack Trace:
- Provider Error messages:
Issue Analytics
- State:
- Created 6 years ago
- Reactions:27
- Comments:13 (3 by maintainers)
Top Results From Across the Web
Variables - Serverless Framework
To reference environment variables, use the ${env:SOME_VAR} syntax in your serverless.yml configuration file. It is valid to use the empty string in place ......
Read more >AWS Lambda Guide - Serverless.yml Reference
The serverless package or serverless deploy commands package the code of all functions into zip files. These zip files are then used for...
Read more >Resolution of environment variables - Serverless Framework
If stage is not explicitly defined, it defaults to dev . Variable expansion. It is possible to define environment variables as a combination...
Read more >Serverless Framework Deprecations
The serverless.yml setting is ineffective for deprecations reported before the ... An alternative to free-form CLI options is to use environment variables.
Read more >Serverless Framework Commands - AWS Lambda - Deploy
Run this command when you have made infrastructure changes (i.e., you edited serverless.yml ). Use serverless deploy function -f myFunction when you have ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
We should have a command like
sls deploy --file serverless-foo.yml
Hi @ccll , thanks for the question/idea.
Having dynamic yaml imports based on the stage should be possible already by using the variable system.
You also could retrieve any value from the environment if you want to make the imports dependent on these with
${env:xxxxxx}
as variable reference.