Variables
The Serverless Framework provides a powerful variable system which allows you to add dynamic data into your serverless.yml. With Serverless variables, you will be able to do the following:
- Reference & load environment variables.
- Reference & load variables from CLI options.
- Recursively reference properties of any type from the same serverless.yml file.
- Recursively reference properties of any type from other YAML or JSON files.
- Recursively nest variable references for ultimate flexibility.
- Combine multiple variable references to overwrite each other.
You can only use variables in values attribute instead of key attribute in serverless.yml. So you cannot use variables to generate dynamic logical IDs in the custom resources.
Referencing Environment Variables
service: new-service provider: name: huawei runtime: Node.js14.18 credentials: ~/.fg/credentials # path must be absolute environment: variables: ENV_FIRST: ${env:TENCENTCLOUD_APPID} plugins: - serverless-huawei-functions functions: hello: handler: index.hello
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot