-1

我正在尝试使用以下 terraform 代码创建 aws cloudwatch 事件目标:


resource "aws_cloudwatch_event_rule" "push-event-processing-sqs" {
   name =         "Push-to-sqs-event-processing-every-2-hours" 
   description =         "Push to SQS event-processing every 2 hours" 
   schedule_expression = "cron(0 /2 ? * * *)"
   is_enabled = "false"
}



resource "aws_cloudwatch_event_target" "target-event-processing-sqs" {
  arn = "arn:aws:sqs:us-west-2:123456789:my-sqs-queue-dev.fifo"
  rule = "${aws_cloudwatch_event_rule.push-event-processing-sqs.name}"
  sqs_target = "foobar"
}

我得到的错误是:

sqs_target:应该是一个列表

我查看了https://www.terraform.io/docs/providers/aws/r/cloudwatch_event_target.html,但没有得到太多帮助。

应该是什么样的清单?

4

1 回答 1

2

所以你的 sqs_target 被错误地使用了。根据文档,它应该具有以下格式:

resource "aws_cloudwatch_event_target" "target-event-processing-sqs" {
  ...
  sqs_target {
    message_group_id = "foobar"
  }
}

message_group_id -(可选)用作目标的 FIFO 消息组 ID。

于 2020-04-13T08:07:12.263 回答