From 347675b8aea8639ac35242da88230978d000ab4f Mon Sep 17 00:00:00 2001 From: Walery Strauch Date: Wed, 3 Feb 2021 13:57:09 +0100 Subject: [PATCH 1/2] Add Sub function example to Pseudo Parameters doc. Update documentation for change added in serverless/serverless#8279 --- docs/providers/aws/guide/variables.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/providers/aws/guide/variables.md b/docs/providers/aws/guide/variables.md index 2377eae6896..0f1eca64a9a 100644 --- a/docs/providers/aws/guide/variables.md +++ b/docs/providers/aws/guide/variables.md @@ -675,6 +675,15 @@ Resources: - 'log-group:/aws/lambda/*:*:*' ``` +You can also directly use the [Sub] function: + +```yml +Resources: + - !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. From c3ff60dfb666b27bcb248518d3f29cd46b18ad20 Mon Sep 17 00:00:00 2001 From: Walery Strauch Date: Thu, 4 Feb 2021 14:19:38 +0100 Subject: [PATCH 2/2] Enhance Pseudo Parameters examples in aws doc. The examples are now valid part of serverless. See serverless/serverless#8885 discussion. --- docs/providers/aws/guide/variables.md | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/docs/providers/aws/guide/variables.md b/docs/providers/aws/guide/variables.md index 0f1eca64a9a..532fa6a3ccf 100644 --- a/docs/providers/aws/guide/variables.md +++ b/docs/providers/aws/guide/variables.md @@ -666,20 +666,27 @@ 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 -Resources: - - !Sub arn:aws:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/lambda/*:*:*' +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