message: vtl refactored to allow message attributes
diff: @@ -85,22 +85,22 @@ export class TheBigFanStack extends cdk.Stack {
  .addMethod('POST', new apigw.Integration({
  type: apigw.IntegrationType.AWS, //native aws integration
  integrationHttpMethod: "POST",
  - uri: 'arn:aws:apigateway:us-east-1:sns:action/Publish', // This is how we setup an SNS Topic publish operation.
  + uri: 'arn:aws:apigateway:us-east-1:sns:path//', // This is how we setup an SNS Topic publish operation.
  options: {
  credentialsRole: apigwSnsRole,
  requestParameters: {
  - 'integration.request.header.Content-Type': "'application/json'",
  - 'integration.request.querystring.Version': "'2010-03-31'",
  - 'integration.request.querystring.TargetArn': "'"+topic.topicArn+"'",
  - 'integration.request.querystring.MessageAttributes.entry.1.Name': "'status'",
  - 'integration.request.querystring.MessageAttributes.entry.1.Value.DataType': "'String'"
  + 'integration.request.header.Content-Type': "'application/x-www-form-urlencoded'"
  },
  requestTemplates: {
  // This is the VTL to transform our incoming request to post to our SNS topic
  // Check: https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html
  - 'application/json': "#set($context.requestOverride.querystring.Message = \"$input.path('$.message')\") \n"+
  - "## Add in value for Message Attribute \n" +
  - "#set($context.requestOverride.querystring.MessageAttributes.entry.1.Value.StringValue = \"created\")"
  + 'application/json': "Action=Publish&"+
  + "TargetArn=$util.urlEncode('"+topic.topicArn+"')&"+
  + "Message=hello&"+
  + "Version=2010-03-31&"+
  + "MessageAttributes.entry.1.Name=status&"+
  + "MessageAttributes.entry.1.Value.DataType=String&"+
  + "MessageAttributes.entry.1.Value.StringValue=created"
  },
  passthroughBehavior: apigw.PassthroughBehavior.NEVER,
  integrationResponses: [
  