Terraform:新的文物提供者-Slack Notification Chann

时间:2019-03-13 17:16:02

标签: terraform slack newrelic

寻找一个好的例子或输入列表,以提供Terraform脚本来创建新的遗物闲置警报通道。我发现的唯一示例是在Terraform文档中,但仅用于电子邮件。

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

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

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

1 个答案:

答案 0 :(得分:0)

资源newrelic_alert_channel确实支持slack类型。

  

type-(必需)通道的类型。篝火,电子邮件,嘻哈,opsgenie,pagerduty,松弛,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/***********"
  }
}