diff --git a/main.tf b/main.tf index 6681ebaf45c9f99f90ce3bad11625cf9758847a9..892125db03981ffa508b5dd53fa697f9a65f63a4 100644 --- a/main.tf +++ b/main.tf @@ -146,4 +146,5 @@ module "uptime_monitoring" { monitored_domain = var.dns_name uptime_timeout = var.alerting_uptime_timeout uptime_period = var.alerting_uptime_period + enabled = var.alerting_enabled } diff --git a/modules/monitoring/main.tf b/modules/monitoring/main.tf index d624d437cbbf0dd093bbab2df4dacd465ba30d40..09c8db9b070b04e780e1e82c69d05402756c03b1 100644 --- a/modules/monitoring/main.tf +++ b/modules/monitoring/main.tf @@ -49,6 +49,7 @@ resource "google_monitoring_notification_channel" "notification_email" { } resource "google_monitoring_alert_policy" "uptime_alert" { + enabled = var.enabled count = local.count project = var.project display_name = "HTTP uptime alert" diff --git a/modules/monitoring/variables.tf b/modules/monitoring/variables.tf index d71429d7bc76d73ca777505ce0bef46d875ae8df..1f54f74852fc17768ae18e026fdb88636889882f 100644 --- a/modules/monitoring/variables.tf +++ b/modules/monitoring/variables.tf @@ -31,3 +31,9 @@ variable "uptime_period" { default = "300s" description = "Frequency of uptime checks" } + +variable "enabled" { + type = bool + default = true + description = "Whether the alerting policy is enabled" +} diff --git a/variables.tf b/variables.tf index d903a8ce2231dbbbaf34db302ec4333e74190ae9..2541bc31f43cc1c6499b47d212e7958d0ec4de3d 100644 --- a/variables.tf +++ b/variables.tf @@ -105,3 +105,9 @@ variable "alerting_uptime_period" { default = "300s" description = "Frequency of uptime checks" } + +variable "alerting_enabled" { + type = boolean + default = true + description = "Whether alerting policy is enabled" +}