目标的 AWS::Events::Rule 输入不是有效的 JSON 文本

问题描述

我的 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,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>"'

如果我尝试部署此堆栈,它会失败并显示异常 Input for target LogGroupTarget is not a valid JSON text.

UPD:

如果我将 InputTemplate 设为 '{"message":"cusId = <customer-id> - <destination-type> for <provider-id>"}',它会起作用。但是,在文档、示例甚至 UI 中字段的占位符中,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>"

是否可以将 InputTemplate 指定为字符串?

谢谢。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)