Kevin Dave
Kevin Dave

Reputation: 447

How to have different yml file for different branch in Serverless framework

I use Serverless framework for managing my AWS lambda function. And I also use git for managing with other developer. I have 2 branch which is development and production. If the feature is ready for release, we will merge the development branch into the master which is my production branch.

My question is, is there any way to seperate the provider and functions configuration in .yml file ? I need to ignore the provider section, so each branch has its own config, but I need the functions to be updated from development stage to production stage.

Upvotes: 0

Views: 700

Answers (1)

dege
dege

Reputation: 2949

If you're using some kind of env variable to determine the state dev and prod.

you could have something like this:

serverless.yml

...
provider: ${file(./path_to_extra_yaml/${env:STATE}-provider.yml)}
...

then you can have extra confirgurations for the provider

dev-provider.yml

...
name: aws
region: us-west-1
runtime: java
...

prod-provider.yml

...
name: aws
region: us-west-2
runtime: java
...

Upvotes: 3

Related Questions