Terraform事件监视器迁移

发布于 2025-01-21 12:01:53 字数 1066 浏览 2 评论 0原文

尝试根据

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

爱格式化 2025-01-28 12:01:53

我的坏。更改了提供商版本后,我没有重新启动状态文件。

编辑:
在监视迁移之前,我使用了旧的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 triggering init Terraform command, I just went straight with apply. Instead I should have initialized it first (init).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文