Terraform:Newrelic Provider - Slack Notification Channel

问题描述 投票:0回答:1

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

在这里猜测,但Slack可能有所不同

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

  configuration = {
    recipients              = "[email protected]"
    include_json_attachment = "1"
  }
}
terraform slack newrelic
1个回答
0
投票

资源newrelic_alert_channel确实支持slack类型。

type - (必需)通道的类型。其中之一:篝火,电子邮件,hipchat,opsgenie,pagerduty,slack,victorops或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/***********"
  }
}
© www.soinside.com 2019 - 2024. All rights reserved.