Variables and plugins

Variables are the values that can be passed to the configuration values within the serverless.yml while running the Serverless Framework command. They need to pass reference values enclosed in ${} brackets, but you can use variables in property values rather than in the property keys. The following code shows how this is added in the serverless.yml file:  

provider:      name: aws      stage: ${opt:stage, 'dev'}

In the following statement, we pass the parameter to the CLI and the stage value is populated in the serverless.yml file:

$ serverless deploy --stage qa

The variables can be used recursively as reference properties—that is, we can combine multiple values and variable sources, as shown in the following environment variable:  ...

Get DevOps for Serverless Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.