diff --git a/modules/vigil/configuration.tf b/modules/vigil/configuration.tf index 6c44497..b837c3d 100644 --- a/modules/vigil/configuration.tf +++ b/modules/vigil/configuration.tf @@ -21,6 +21,7 @@ locals { custom_html = var.custom_html services = local.services_toml startup_notification = var.notify_on_startup + telegram_enable = var.notify_telegram.token == "" ? "# " : "" // Disable telegram if token is not set telegram_bot_token = var.notify_telegram.token telegram_chat_id = var.notify_telegram.channel }) diff --git a/modules/vigil/vigil.toml.tpl b/modules/vigil/vigil.toml.tpl index 57a5bdc..f62c46a 100644 --- a/modules/vigil/vigil.toml.tpl +++ b/modules/vigil/vigil.toml.tpl @@ -59,9 +59,9 @@ reminder_interval = 600 reminder_backoff_function = "linear" reminder_backoff_limit = 3 -[notify.telegram] -bot_token = "${telegram_bot_token}" -chat_id = "${telegram_chat_id}" +${telegram_enable}[notify.telegram] +${telegram_enable}bot_token = "${telegram_bot_token}" +${telegram_enable}chat_id = "${telegram_chat_id}" [probe] diff --git a/vigil.tf b/vigil.tf index ab32ef0..0997a5f 100644 --- a/vigil.tf +++ b/vigil.tf @@ -11,12 +11,15 @@ module "vigil_nginx_config" { } variable "telegram_token" { type = string + default = "" } variable "telegram_channel" { type = string + default = "" } variable "telegram_topic" { type = string + default = "" } module "vigil" { source = "./modules/vigil"