【发布时间】:2022-06-22 00:43:22
【问题描述】:
我正在按照this 迁移指南将我们的一个数据狗监视器从event alert 升级到event-v2 alert。我们的监视器是使用 Datadog Terraform 提供程序创建的。
当前监视器使用event alert 类型:
resource "datadog_monitor" "guardduty_high_severity_findings" {
name = "[tf] [${terraform.workspace}] AWS Guardduty Reporting High Severity Findings"
type = "event alert"
message = <<EOT
Some custom message
EOT
escalation_message = <<EOT
<nil>
EOT
tags = ["system:ops", "service:aws"]
query = "events('sources:sns priority:all').rollup('count').last('xm') > 0"
notify_no_data = false
no_data_timeframe = 0
renotify_interval = 0
notify_audit = false
timeout_h = 0
include_tags = true
}
此监视器按预期工作,一旦检测到 AWS GuardDuty 事件,就会触发 Datadog 警报。
使用 event-v2 alert 类型迁移的监视器:
resource "datadog_monitor" "guardduty_high_severity_findings" {
name = "[tf] [${terraform.workspace}] AWS Guardduty Reporting High Severity Findings"
type = "event-v2 alert"
message = <<EOT
Some custom message
EOT
escalation_message = <<EOT
<nil>
EOT
tags = ["system:ops", "service:aws"]
query = "events('sources:amazon_sns').rollup('count').last('xm') > 0"
notify_no_data = false
no_data_timeframe = 0
renotify_interval = 0
notify_audit = false
timeout_h = 0
include_tags = true
}
但是,这会在执行 terraform 计划时出错,指出请求已被 DataDog 拒绝,因为查询格式无效。
$ terraform plan
...
Error: error validating monitor from https://api.datadoghq.com/api/v1/monitor/validate: 400 Bad Request: {"errors": ["The value provided for parameter 'query' is invalid: invalid operator specified: "]}
with datadog_monitor.guardduty_high_severity_findings,
on monitors-static.tf line 106, in resource "datadog_monitor" "guardduty_high_severity_findings":
106: resource "datadog_monitor" "guardduty_high_severity_findings" {
感谢是否有人可以帮助找出这里出了什么问题。
【问题讨论】:
标签: terraform datadog terraform-provider