Terraform - 在输入模板中使用日期创建 CloudWatch 事件目标

问题描述 投票:0回答:0

我正在创建一个以 SQS 为目标的 cloudwatch 事件规则,需要传递包含当前日期(每天计算)的 JSON 作为输入。

这是我在 terraform 中创建的目标:

resource "aws_cloudwatch_event_target" "target_all" {
  rule      = aws_cloudwatch_event_rule.schedule_all.name
  target_id = "SendToSQS"
  arn       = local.queue_arn
  
  input_transformer {
    input_template = jsonencode({
      "command" : {
        "command_name" : "sample_command",
        "date" :  "<aws.scheduler.scheduled-time>",
      },
      "service" : "ecs",
      "source" : "scheduled"
    })
  }
} 

我已经引用了此链接 -https://docs.aws.amazon.com/scheduler/latest/UserGuide/managing-schedule-context-attributes.html 使用

"<aws.scheduler.scheduled-time>"
但这不起作用。

amazon-web-services terraform amazon-cloudwatch
© www.soinside.com 2019 - 2024. All rights reserved.