Last active
November 12, 2019 03:22
-
-
Save hoang-innomize/192192145f02c408cdb56f58e98bd4c6 to your computer and use it in GitHub Desktop.
A serverless example for configuring different vpc per stage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
service: serverless-toggle-vpc-example | |
provider: | |
runtime: nodejs10.x | |
name: aws | |
vpc: ${self:custom.vpc.${self:provider.stage}} | |
custom: | |
vpc: | |
dev: | |
# If you don't want to run Lambda under a Vpc, then just give it an empty array | |
securityGroupIds: [] | |
subnetIds: [] | |
# You can add more stages here | |
prod: | |
securityGroupIds: | |
Fn::Split: | |
- ',' | |
- ${file(secrets.${self:provider.stage}.yml):VPC_SECURITY_GROUP_IDS} | |
subnetIds: | |
Fn::Split: | |
- ',' | |
- ${file(secrets.${self:provider.stage}.yml):VPC_SUBNET_IDS} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment