Terraform:新的 Relic Provider - Slack 通知通道

Terraform: New Relic Provider - Slack Notification Chann

正在寻找一个很好的示例或输入列表来为 Terraform 脚本提供创建 New Relic Slack Alert Channel。我找到的唯一示例是在 Terraform 文档中,但用于电子邮件。

这里猜测一下,但Slack可能有不同

# Add a notification channel
resource "newrelic_alert_channel" "email" {
  name = "email"
  type = "email"

  configuration = {
    recipients              = "paul@example.com"
    include_json_attachment = "1"
  }
}

资源 newrelic_alert_channel 确实支持 slack 类型。

type - (Required) The type of channel. One of: campfire, email, hipchat, opsgenie, pagerduty, slack, victorops, or webhook.

参考:https://github.com/terraform-providers/terraform-provider-newrelic/blob/c1b47912aae73dffc2dbab8b7082ae46942aa8f9/newrelic/resource_newrelic_alert_channel.go#L37-L40

"slack": {
    "channel",
    "url",
},

我没有测试过,但是这段代码能用吗?

resource "newrelic_alert_channel" "slack" {
  name = "alerts"
  type = "slack"

  configuration = {
    channel = "alerts"
    url     = "https://hooks.slack.com/services/***********"
  }
}