From 065c1087fdf3fc86f022ec3abde915b277f46704 Mon Sep 17 00:00:00 2001 From: Bill Fine Date: Sat, 13 Jul 2019 17:48:26 -0700 Subject: [PATCH] Adding Output Variables page. --- docs/dashboard/output_variables | 50 +++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 docs/dashboard/output_variables diff --git a/docs/dashboard/output_variables b/docs/dashboard/output_variables new file mode 100644 index 000000000..094ea9827 --- /dev/null +++ b/docs/dashboard/output_variables @@ -0,0 +1,50 @@ + + + + +### [Read this on the main serverless docs site](https://www.serverless.com/framework/docs/) + + + +# Output Variables + +The Serverless Framework Dashboard helps you refactor large serverless applications by decoupling the shared services from the dependent services. The new output variables feature allows you to define output variables in a `serverless.yml` and then reference those variables in other `serverless.yml` files. The values are published to Serverless Framework Dashboard when you deploy, and they are loaded in other services when they are deployed. + +## Define output variables for shared services + +Define new output variables by adding a dictionary (key/value pairs) to the `outputs:` field in the `serverless.yml` file. The values can include any value supported by YAML including strings, integers, lists (arrays), and dictionaries (key/value pairs). The dictionaries can also be nested to any depth. + +**serverless.yml** +```yaml +outputs: + my-key: my-value + my-availability-zones: + - us-east-1a + - us-east-1b + my-table-name: DynamoDbTable-${self:custom.stage} +``` + +The values will be interpolated and saved when the service is deployed. The values are saved as a part of the service instance so they are associated with the service, stage and region. + +## Use output variables in dependent services + +Output variables can be consumed from other services with they `${state}` variable. The reference must be formatted as `.`, where the `` references another service in the same application, stage and region and the `` references the dictionary key from the `outputs:`. The `` can also be nested to reference nested values from the dictionary. + +**serverless.yml** +```yaml +${state:my-service.var-key} +``` + +## View output variables in the dashboard + +The output variables for a service are made available on two different pages of the Serverless Framework Dashboard. + +The current output variables for a given service instance are available in the **Variables** > **Output** section of the service instance view. This will show the values which are currently available. + +The historic output variables for a given service instance are available as a part of the deployment record which is available in the **activity & insights** section of the service instance view after a deployment. + +