From ac1d51559891c5603c5a872bd4e54ff4406cd590 Mon Sep 17 00:00:00 2001 From: Quentin Manfroi Date: Sat, 24 Mar 2018 17:12:22 +0100 Subject: [PATCH 1/7] MON-82 Add readme for alerting message module --- common/alerting-message/README.md | 39 +++++++++++++++++++++++++++++++ common/alerting-message/inputs.tf | 16 ++++++++----- 2 files changed, 49 insertions(+), 6 deletions(-) create mode 100644 common/alerting-message/README.md diff --git a/common/alerting-message/README.md b/common/alerting-message/README.md new file mode 100644 index 0000000..60315f0 --- /dev/null +++ b/common/alerting-message/README.md @@ -0,0 +1,39 @@ +Alerting Message Datadog Generator +================================== + +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_24x7 = "${var.oncall_24x7}" + oncall_office_hours = "${var.oncall_office_hours}" +} +``` + +Purpose +------- + +Creates a DataDog monitor alert message with the following inputs : + +* PagerDuty NBH service name +* PagerDuty BH service name +* Prepend test free string +* Append text free string + +Inputs +------ + +| Name | Description | Type | Default | Required | +|------|-------------|:----:|:-----:|:-----:| +| append_text | Optional free text string to append to alert | string | `` | no | +| oncall_24x7 | Define PagerDuty NBH service name for alerts and nodata | string | - | yes | +| oncall_office_hours | Define PagerDuty BH service name for warning alerts | string | - | yes | +| prepend_text | Optional free text string to prepend to alert | string | `` | no | + +Related documentation +--------------------- + +DataDog documentation: [https://docs.datadoghq.com/integrations/azure_app_services](https://docs.datadoghq.com/integrations/azure_app_services) diff --git a/common/alerting-message/inputs.tf b/common/alerting-message/inputs.tf index f20bef7..8422020 100644 --- a/common/alerting-message/inputs.tf +++ b/common/alerting-message/inputs.tf @@ -1,17 +1,21 @@ variable "oncall_24x7" { - type = "string" + description = "Define PagerDuty NBH service name for alerts and nodata" + type = "string" } variable "oncall_office_hours" { - type = "string" + description = "Define PagerDuty BH service name for warning alerts" + type = "string" } variable "prepend_text" { - type = "string" - default = "" + description = "Optional free text string to prepend to alert" + type = "string" + default = "" } variable "append_text" { - type = "string" - default = "" + description = "Optional free text string to append to alert" + type = "string" + default = "" } From 65b8b2e8d0edd9567e8bc9fb891910bce6ea110a Mon Sep 17 00:00:00 2001 From: Alexandre Gaillet Date: Mon, 26 Mar 2018 18:08:38 +0200 Subject: [PATCH 2/7] MON-82 - alerting-message variables updated --- common/alerting-message/README.md | 10 +++++----- common/alerting-message/inputs.tf | 8 ++++---- common/alerting-message/main.tf | 14 +++++++------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/common/alerting-message/README.md b/common/alerting-message/README.md index 60315f0..3f9b8ec 100644 --- a/common/alerting-message/README.md +++ b/common/alerting-message/README.md @@ -6,10 +6,10 @@ 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}" + source = "git::ssh://git@bitbucket.org/morea/terraform.feature.datadog.git//common/alerting-message?ref={revision}" - oncall_24x7 = "${var.oncall_24x7}" - oncall_office_hours = "${var.oncall_office_hours}" + oncall_alert = "${var.oncall_alert}" + oncall_warning = "${var.oncall_warning}" } ``` @@ -29,8 +29,8 @@ Inputs | Name | Description | Type | Default | Required | |------|-------------|:----:|:-----:|:-----:| | append_text | Optional free text string to append to alert | string | `` | no | -| oncall_24x7 | Define PagerDuty NBH service name for alerts and nodata | string | - | yes | -| oncall_office_hours | Define PagerDuty BH service name for warning alerts | string | - | yes | +| oncall_alert | Define a broadcast channel for critical alerts | string | - | yes | +| oncall_warning | Define a broadcast channel for warning alerts | string | - | yes | | prepend_text | Optional free text string to prepend to alert | string | `` | no | Related documentation diff --git a/common/alerting-message/inputs.tf b/common/alerting-message/inputs.tf index 8422020..e565f89 100644 --- a/common/alerting-message/inputs.tf +++ b/common/alerting-message/inputs.tf @@ -1,10 +1,10 @@ -variable "oncall_24x7" { - description = "Define PagerDuty NBH service name for alerts and nodata" +variable "oncall_alert" { + description = "Define a broadcast channel for critical alerts" type = "string" } -variable "oncall_office_hours" { - description = "Define PagerDuty BH service name for warning alerts" +variable "oncall_warning" { + description = "Define a broadcast channel for warning alerts" type = "string" } diff --git a/common/alerting-message/main.tf b/common/alerting-message/main.tf index cc45af5..ee083aa 100644 --- a/common/alerting-message/main.tf +++ b/common/alerting-message/main.tf @@ -1,17 +1,17 @@ data "template_file" "alerting-message" { template = < Date: Tue, 27 Mar 2018 10:13:18 +0200 Subject: [PATCH 3/7] MON-82 - Fix remaining variables --- common/alerting-message/main.tf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/common/alerting-message/main.tf b/common/alerting-message/main.tf index ee083aa..7339c3f 100644 --- a/common/alerting-message/main.tf +++ b/common/alerting-message/main.tf @@ -10,9 +10,9 @@ $${append_text} EOF vars { - oncall_24x7 = "${var.oncall_alert}" - oncall_office_hours = "${var.oncall_warning}" - prepend_text = "${var.prepend_text}" - append_text = "${var.append_text}" + oncall_alert = "${var.oncall_alert}" + oncall_warning = "${var.oncall_warning}" + prepend_text = "${var.prepend_text}" + append_text = "${var.append_text}" } } From aea54196f61edf2a1df6ddd15a8f4746dbd51d57 Mon Sep 17 00:00:00 2001 From: Alexandre Gaillet Date: Tue, 27 Mar 2018 11:05:29 +0200 Subject: [PATCH 4/7] MON-82 - Nodata variable added and locals used to define it with oncall_alert value --- common/alerting-message/README.md | 6 ++++-- common/alerting-message/inputs.tf | 6 ++++++ common/alerting-message/main.tf | 8 +++++++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/common/alerting-message/README.md b/common/alerting-message/README.md index 3f9b8ec..a752715 100644 --- a/common/alerting-message/README.md +++ b/common/alerting-message/README.md @@ -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 | diff --git a/common/alerting-message/inputs.tf b/common/alerting-message/inputs.tf index e565f89..da4a755 100644 --- a/common/alerting-message/inputs.tf +++ b/common/alerting-message/inputs.tf @@ -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" diff --git a/common/alerting-message/main.tf b/common/alerting-message/main.tf index 7339c3f..9839765 100644 --- a/common/alerting-message/main.tf +++ b/common/alerting-message/main.tf @@ -1,3 +1,7 @@ +locals { + oncall_nodata = "${var.oncall_nodata == "" ? var.oncall_alert : var.oncall_nodata}" +} + data "template_file" "alerting-message" { template = < Date: Tue, 27 Mar 2018 11:42:46 +0200 Subject: [PATCH 5/7] MON-82 - Variables names changed for better understanding --- common/alerting-message/README.md | 17 +++++++++-------- common/alerting-message/inputs.tf | 6 +++--- common/alerting-message/main.tf | 24 ++++++++++++------------ 3 files changed, 24 insertions(+), 23 deletions(-) diff --git a/common/alerting-message/README.md b/common/alerting-message/README.md index a752715..86eff6f 100644 --- a/common/alerting-message/README.md +++ b/common/alerting-message/README.md @@ -8,9 +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.message_alert}" - oncall_warning = "${var.message_warning}" - oncall_nodata = "${var.message_nodata}" + message_alert = "${var.oncall_24x7}" + message_warning = "${var.oncall_business_hours}" + message_nodata = "${var.oncall_nodata}" } ``` @@ -19,8 +19,9 @@ Purpose Creates a DataDog monitor alert message with the following inputs : -* PagerDuty NBH service name -* PagerDuty BH service name +* A broadcast channel for critical alerts +* A broadcast channel for nodata alerts +* A broadcast channel for warning alerts * Prepend test free string * Append text free string @@ -30,9 +31,9 @@ Inputs | Name | Description | Type | Default | Required | |------|-------------|:----:|:-----:|:-----:| | 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 | +| message_alert | Define a broadcast channel for critical alerts | string | - | yes | +| message_nodata | Define a broadcast channel for nodata alerts | string | `` | no | +| message_warning | Define a broadcast channel for warning alerts | string | - | yes | | prepend_text | Optional free text string to prepend to alert | string | `` | no | Related documentation diff --git a/common/alerting-message/inputs.tf b/common/alerting-message/inputs.tf index da4a755..7a0e3ec 100644 --- a/common/alerting-message/inputs.tf +++ b/common/alerting-message/inputs.tf @@ -1,14 +1,14 @@ -variable "oncall_alert" { +variable "message_alert" { description = "Define a broadcast channel for critical alerts" type = "string" } -variable "oncall_warning" { +variable "message_warning" { description = "Define a broadcast channel for warning alerts" type = "string" } -variable "oncall_nodata" { +variable "message_nodata" { description = "Define a broadcast channel for nodata alerts" type = "string" default = "" diff --git a/common/alerting-message/main.tf b/common/alerting-message/main.tf index 9839765..2400d16 100644 --- a/common/alerting-message/main.tf +++ b/common/alerting-message/main.tf @@ -1,24 +1,24 @@ locals { - oncall_nodata = "${var.oncall_nodata == "" ? var.oncall_alert : var.oncall_nodata}" + oncall_nodata = "${var.message_nodata == "" ? var.message_alert : var.message_nodata}" } data "template_file" "alerting-message" { template = < Date: Tue, 27 Mar 2018 12:00:34 +0200 Subject: [PATCH 6/7] MON-82 - Locals removed to use coalesce --- common/alerting-message/main.tf | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/common/alerting-message/main.tf b/common/alerting-message/main.tf index 2400d16..81b3369 100644 --- a/common/alerting-message/main.tf +++ b/common/alerting-message/main.tf @@ -1,7 +1,3 @@ -locals { - oncall_nodata = "${var.message_nodata == "" ? var.message_alert : var.message_nodata}" -} - data "template_file" "alerting-message" { template = < Date: Thu, 29 Mar 2018 17:30:28 +0200 Subject: [PATCH 7/7] MON-82 fix readme typo --- common/alerting-message/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/alerting-message/README.md b/common/alerting-message/README.md index 86eff6f..067682e 100644 --- a/common/alerting-message/README.md +++ b/common/alerting-message/README.md @@ -22,7 +22,7 @@ Creates a DataDog monitor alert message with the following inputs : * A broadcast channel for critical alerts * A broadcast channel for nodata alerts * A broadcast channel for warning alerts -* Prepend test free string +* Prepend text free string * Append text free string Inputs