Skip to content

Commit a727a5a

Browse files
committed
docs: update readme to show usage in Fn::Sub
1 parent 35c6ffa commit a727a5a

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

README.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,10 @@ Source: [AWS::ApiGateway::Method docs](https://docs.aws.amazon.com/AWSCloudForma
313313
If you'd like to add content types or customize the default templates, you can do so by including your custom [API Gateway request mapping template](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html) in `serverless.yml` like so:
314314

315315
```yml
316+
# Required for using Fn::Sub
317+
plugins:
318+
- serverless-cloudformation-sub-variables
319+
316320
custom:
317321
apiGatewayServiceProxies:
318322
- kinesis:
@@ -344,6 +348,10 @@ Source: [How to connect SNS to Kinesis for cross-account delivery via API Gatewa
344348
Similar to the [Kinesis](#kinesis-1) support, you can customize the default request mapping templates in `serverless.yml` like so:
345349

346350
```yml
351+
# Required for using Fn::Sub
352+
plugins:
353+
- serverless-cloudformation-sub-variables
354+
347355
custom:
348356
apiGatewayServiceProxies:
349357
- kinesis:
@@ -353,11 +361,9 @@ custom:
353361
request:
354362
template:
355363
application/json:
356-
'Fn::Join':
357-
- ''
358-
- - "Action=Publish&Message=$util.urlEncode('This is a fixed message')&TopicArn=$util.urlEncode('"
359-
- { Ref: MyTopic }
360-
- "')"
364+
Fn::Sub:
365+
- "Action=Publish&Message=$util.urlEncode('This is a fixed message')&TopicArn=$util.urlEncode('#{MyTopicArn}')"
366+
- MyTopicArn: { Ref: MyTopic }
361367
```
362368

363369
> It is important that the mapping template will return a valid `application/x-www-form-urlencoded` string

0 commit comments

Comments
 (0)