FAQ | This is a LIVE service | Changelog

Skip to content
Snippets Groups Projects
Commit af567ecf authored by Monty Dawson's avatar Monty Dawson :coffee:
Browse files

Allow alert name and documentation to be customised

parent f2365745
No related branches found
No related tags found
No related merge requests found
Pipeline #71463 passed
......@@ -4,9 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [1.0.1] - 2021-03-31
## [1.0.1] - 2021-04-01
### Added
- Allow environment variables to be passed in through variables
- Allow alert name and documentation to be customized
## [1.0.0] - 2021-03-16
### Added
......
......@@ -16,6 +16,10 @@ locals {
# A kebab-case name in case we're given underscore_case.
kebab_name = replace(var.name, "_", "-")
alert_display_name = var.alert_display_name != "" ? var.alert_display_name : (
"Invocations of ${var.name} script succeeds (${terraform.workspace})"
)
}
# The source code of the script.
......@@ -193,7 +197,7 @@ resource "google_logging_metric" "successes" {
resource "google_monitoring_alert_policy" "successes" {
project = local.monitoring_project
display_name = "Invocations of ${var.name} script succeeds (${terraform.workspace})"
display_name = local.alert_display_name
enabled = var.alert_enabled
......@@ -204,9 +208,13 @@ resource "google_monitoring_alert_policy" "successes" {
combiner = "OR"
documentation {
content = var.alert_documentation
}
conditions {
# Include the workspace name in the alert text to aid triaging alerts.
display_name = "Invocations of ${var.name} script succeeds (${terraform.workspace})"
display_name = local.alert_display_name
condition_threshold {
# We're interested in Cloud Scheduler successes for the job in the
......
......@@ -119,6 +119,23 @@ variable "alert_enabled" {
EOT
}
variable "alert_display_name" {
default = ""
description = <<-EOT
The display name for the alert that is fired if this script fails - this is used in the
header of the email if the script fails and this alert is triggered. A sensible default
is used if no value is given.
EOT
}
variable "alert_documentation" {
default = ""
description = <<-EOT
The documentation that is included in the email sent if this script fails. This should
describe what can be done to stop the script from failing.
EOT
}
variable "secret_configuration" {
default = ""
description = <<-EOT
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment