MON-82 - Nodata variable added and locals used to define it with oncall_alert value
This commit is contained in:
parent
74b37e35a3
commit
aea54196f6
@ -8,8 +8,9 @@ How to use this module
|
||||
module "datadog-message-alerting" {
|
||||
source = "git::ssh://git@bitbucket.org/morea/terraform.feature.datadog.git//common/alerting-message?ref={revision}"
|
||||
|
||||
oncall_alert = "${var.oncall_alert}"
|
||||
oncall_warning = "${var.oncall_warning}"
|
||||
oncall_alert = "${var.message_alert}"
|
||||
oncall_warning = "${var.message_warning}"
|
||||
oncall_nodata = "${var.message_nodata}"
|
||||
}
|
||||
```
|
||||
|
||||
@ -30,6 +31,7 @@ Inputs
|
||||
|------|-------------|:----:|:-----:|:-----:|
|
||||
| append_text | Optional free text string to append to alert | string | `` | no |
|
||||
| oncall_alert | Define a broadcast channel for critical alerts | string | - | yes |
|
||||
| oncall_nodata | Define a broadcast channel for nodata alerts | string | `` | no |
|
||||
| oncall_warning | Define a broadcast channel for warning alerts | string | - | yes |
|
||||
| prepend_text | Optional free text string to prepend to alert | string | `` | no |
|
||||
|
||||
|
||||
@ -8,6 +8,12 @@ variable "oncall_warning" {
|
||||
type = "string"
|
||||
}
|
||||
|
||||
variable "oncall_nodata" {
|
||||
description = "Define a broadcast channel for nodata alerts"
|
||||
type = "string"
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "prepend_text" {
|
||||
description = "Optional free text string to prepend to alert"
|
||||
type = "string"
|
||||
|
||||
@ -1,3 +1,7 @@
|
||||
locals {
|
||||
oncall_nodata = "${var.oncall_nodata == "" ? var.oncall_alert : var.oncall_nodata}"
|
||||
}
|
||||
|
||||
data "template_file" "alerting-message" {
|
||||
template = <<EOF
|
||||
$${prepend_text}
|
||||
@ -5,13 +9,15 @@ $${prepend_text}
|
||||
{{#is_recovery}}$${oncall_alert}{{/is_recovery}}
|
||||
{{#is_warning}}$${oncall_warning}{{/is_warning}}
|
||||
{{#is_warning_recovery}}$${oncall_warning}{{/is_warning_recovery}}
|
||||
{{#is_no_data}}$${oncall_alert}{{/is_no_data}}
|
||||
{{#is_no_data}}$${oncall_nodata}{{/is_no_data}}
|
||||
{{#is_no_data_recovery}}$${oncall_nodata}{{/is_no_data_recovery}}
|
||||
$${append_text}
|
||||
EOF
|
||||
|
||||
vars {
|
||||
oncall_alert = "${var.oncall_alert}"
|
||||
oncall_warning = "${var.oncall_warning}"
|
||||
oncall_nodata = "${local.oncall_nodata}"
|
||||
prepend_text = "${var.prepend_text}"
|
||||
append_text = "${var.append_text}"
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user