2

I have the following resource in my SAM template.yml:

MetricsRule:
  Type: AWS::Events::Rule
  Properties:
    Name: MetricsRule
    Description: Puts metrics to the CloudWatch log group
    EventBusName: !FindInMap [LambdaConfig, !Ref stage, eventBusName]
    EventPattern:
      detail:
        status:
          - GENERATED
    State: !FindInMap [LambdaConfig, !Ref stage, eventEnabled]
    Targets:
      - Id: LogGroupTarget
        Arn: !Sub "arn:aws:logs:${AWS::Region}:${AWS::AccountId}:log-group:${LogGroup}"
        InputTransformer:
          InputPathsMap:
            customer-id: $.detail.customerId
            destination-type: $.detail.destinationType
            provider-id: $.detail.providerId
          InputTemplate: '"cusId = <customer-id> - <destination-type> for <provider-id>"'

If I try to deploy this stack it fails with the exception Input for target LogGroupTarget is not a valid JSON text.

UPD:

If I put InputTemplate as '{"message":"cusId = <customer-id> - <destination-type> for <provider-id>"}' it will work. But, in the documentation, examples and even in the placeholder of the field in UI it stands that Input Template: A string containing placeholders which will be filled with values defined in Input Paths e.g. "The state of Instance <instance> is <state>"

Is there any option to specify InputTemplate as a string?

Thanks.

dobeerman
  • 1,354
  • 15
  • 27

1 Answers1

0

I hope author found answer.
But just to have answer here too.
This should work:

  InputTemplate: |
    "cusId = <customer-id> - <destination-type> for <provider-id>"

More information is here: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-events-rule-inputtransformer.html

Dima Kurilo
  • 2,206
  • 1
  • 21
  • 27