Terraform事件监视器迁移
尝试根据
resource "datadog_monitor" "cache_event" {
name = "${var.cache_replication_group} :: Event"
type = "event-v2 alert"
message = join(" ", ["Cache event occured in ${var.cache_replication_group}.", join(" ", var.recipients.general)])
query = "events(\"source:elasticache tags:(replication_group:${var.cache_replication_group}) NOT(Finished)\").rollup(\"count\").last(\"15m\") > 0"
require_full_window = false
tags = concat(var.tags, ["cache:${var.cache_replication_group}", "monitor:stability"])
}
https://docs.datadoghq.com/错误错误:错误创建监视器:Event-V2警报不是有效的Monitortype
,而是根据其 documentation event-v2警报
是有效的类型。目前,datadog Provider版本为3.10.0
,因此它应该支持此 type
Trying to migrate event monitors according to migration steps
resource "datadog_monitor" "cache_event" {
name = "${var.cache_replication_group} :: Event"
type = "event-v2 alert"
message = join(" ", ["Cache event occured in ${var.cache_replication_group}.", join(" ", var.recipients.general)])
query = "events(\"source:elasticache tags:(replication_group:${var.cache_replication_group}) NOT(Finished)\").rollup(\"count\").last(\"15m\") > 0"
require_full_window = false
tags = concat(var.tags, ["cache:${var.cache_replication_group}", "monitor:stability"])
}
But when trying to apply changes Terraform returns the error Error: error creating monitor: event-v2 alert is not a valid MonitorType
, but according to their documentation event-v2 alert
is a valid type. DataDog provider version at the moment is 3.10.0
, hence it should support this type
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我的坏。更改了提供商版本后,我没有重新启动状态文件。
编辑:
在监视迁移之前,我使用了旧的DataDog提供商版本。调整查询以与新事件监视器格式相符之后,我将DataDog提供商版本撞到了支持新
v2
监视器的版本,而不是删除。
init
Terraform命令,我只是使用Apply
直接进行。相反,我应该先初始化它(init
)。My bad. After changing the provider version, I didn't reinitialise the state file.
Edit:
Before monitor migration, I used an older DataDog provider version. After adjusting query to be complient with a new event monitor format, I bumped DataDog provider version to the one that supports new
v2
monitors, but instead of deleting.terraform
folder and triggeringinit
Terraform command, I just went straight withapply
. Instead I should have initialized it first (init
).