From 363dab42d49236a4f31e522fa8e2bfa19f96080c Mon Sep 17 00:00:00 2001 From: exoego Date: Mon, 10 Dec 2018 10:24:38 +0900 Subject: [PATCH] Add custom output example to help using cf-reference. --- docs/providers/aws/guide/variables.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/docs/providers/aws/guide/variables.md b/docs/providers/aws/guide/variables.md index 19a64fc46..64a2b91ea 100644 --- a/docs/providers/aws/guide/variables.md +++ b/docs/providers/aws/guide/variables.md @@ -155,6 +155,32 @@ functions: ``` In that case, the framework will fetch the values of those `functionPrefix` outputs from the provided stack names and populate your variables. There are many use cases for this functionality and it allows your service to communicate with other services/stacks. +You can add such custom output to CloudFormation stack. For example: +```yml +service: another-service +provider: + name: aws + runtime: nodejs8.10 + region: ap-northeast-1 + memorySize: 512 +functions: + hello: + name: ${self:custom.functionPrefix}hello + handler: handler.hello +custom: + functionPrefix: "my-prefix-" +resources: + Outputs: + functionPrefix: + Value: ${self:custom.functionPrefix} + Export: + Name: functionPrefix + memorySize: + Value: ${self:provider.memorySize} + Export: + Name: memorySize +``` + You can also reference CloudFormation stack in another regions with the `cf.REGION:stackName.outputKey` syntax. For example: ```yml service: new-service