From a11a43c5d2d770ca2df849408dad10fe6de95c38 Mon Sep 17 00:00:00 2001 From: Walery Strauch Date: Thu, 4 Feb 2021 14:48:40 +0100 Subject: [PATCH] docs: Add `Sub` function example to pseudo parameters doc. (#8885) --- docs/providers/aws/guide/variables.md | 30 ++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/docs/providers/aws/guide/variables.md b/docs/providers/aws/guide/variables.md index 2377eae6896..532fa6a3ccf 100644 --- a/docs/providers/aws/guide/variables.md +++ b/docs/providers/aws/guide/variables.md @@ -666,15 +666,31 @@ You can reference [AWS Pseudo Parameters](http://docs.aws.amazon.com/AWSCloudFor Here's an example: ```yml -Resources: - - 'Fn::Join': - - ':' - - - 'arn:aws:logs' - - Ref: 'AWS::Region' - - Ref: 'AWS::AccountId' - - 'log-group:/aws/lambda/*:*:*' +functions: + hello: + handler: my-function.handler + environment: + var: + Fn::Join: + - ':' + - - 'arn:aws:logs' + - Ref: 'AWS::Region' + - Ref: 'AWS::AccountId' + - 'log-group:/aws/lambda/*:*:*' +``` + +You can also directly use the [Sub] function: + +```yml +functions: + hello: + handler: my-function.handler + environment: + var: !Sub arn:aws:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/lambda/*:*:*' ``` +[sub]: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-sub.html + ## Read String Variable Values as Boolean Values In some cases, a parameter expect a `true` or `false` boolean value. If you are using a variable to define the value, it may return as a string (e.g. when using SSM variables) and thus return a `"true"` or `"false"` string value.