A CloudFormation Transform Macro that generates random strings or integers.
Because of a (at time of writing 2 and a half year old) bug in the Serverless API SAM transform !Ref or !GetAtt changes in the API definition break deployed APIs.
See the following issues about the bug:
- aws/serverless-application-model#191
- aws/serverless-application-model#660
- aws/serverless-application-model#914
Once this CloudFormation is deployed to your account, add Side8-Fn-Random to your Transform arrays and then use it similar to how you'd use CloudFormation intrinsic functions.
"Side8::Fn::Random":
"Type": "String"|"Integer"
"Length": integer
For example, if you want a 8 character random string in your api's description to force AWS::Serverless-2016-10-31 to generate a deployment, use it like this:
AWSTemplateFormatVersion: 2010-09-09
Transform: ["Side8-Fn-Random", "AWS::Serverless-2016-10-31"]
Resources:
ServerlessApi:
Type: AWS::Serverless::Api
Properties:
StageName: Prod
EndpointConfiguration: REGIONAL
AccessLogSetting: {}
DefinitionBody:
swagger: "2.0"
info:
version: "2017-04-26T03:23:48Z"
title: random-api
description: !Sub
- random description ${RND}
- RND:
Side8::Fn::Random:
Type: String
Length: 8
...