0

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.

Kevin Dave
  • 387
  • 2
  • 5
  • 19
  • Take look at [this answer](https://stackoverflow.com/a/8014154/5563916). – nnovich-OK Dec 20 '17 at 12:14
  • Thank you for answering. I know how to implement the git ignore, but how to create the yml file seperately ? I want the provider section to be different in each branch, which is I don't track it. And I want the functions section to always be updated which is I need to track these files – Kevin Dave Dec 20 '17 at 13:05

1 Answers1

3

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
...
dege
  • 2,824
  • 2
  • 25
  • 33