From c8a254f5e98379ec2fdca55ad952a1b2f0e20e8c Mon Sep 17 00:00:00 2001 From: Julia Aghamyan Date: Mon, 14 Aug 2023 15:43:24 +0400 Subject: [PATCH] fix(master): Change module --- README.md | 5 +++-- sns-topic.tf | 6 +++--- vaiables.tf | 8 ++++++++ 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index f3111dd..e03ca9d 100644 --- a/README.md +++ b/README.md @@ -59,12 +59,13 @@ No resources. |------|-------------|------|---------|:--------:| | [alerts](#input\_alerts) | Alerts | `any` | `[]` | no | | [application\_channel\_alerts](#input\_application\_channel\_alerts) | Application channel alerts | `any` | `[]` | no | -| [application\_channel\_webhook\_url](#input\_application\_channel\_webhook\_url) | Application Teams Channel Webhook URL | `string` | n/a | yes | +| [application\_channel\_webhook\_url](#input\_application\_channel\_webhook\_url) | Application Teams Channel Webhook URL | `string` | `""` | no | | [application\_monitroing\_dashboard](#input\_application\_monitroing\_dashboard) | Application for monitoring EKS cluster | `any` | `[]` | no | | [create\_alerts](#input\_create\_alerts) | Create Alert | `bool` | `true` | no | | [create\_application\_channel](#input\_create\_application\_channel) | Create application alert | `bool` | `true` | no | | [eks\_monitroing\_dashboard](#input\_eks\_monitroing\_dashboard) | Dashboard for monitoring EKS cluster | `any` | `[]` | no | | [enable\_log\_base\_metrics](#input\_enable\_log\_base\_metrics) | n/a | `bool` | `true` | no | +| [enable\_teams\_notifications](#input\_enable\_teams\_notifications) | Enable Teams notifications | `bool` | `false` | no | | [fallback\_email\_addresses](#input\_fallback\_email\_addresses) | List of fallback email addresses to send notification when lambda failed | `list(string)` | `[]` | no | | [fallback\_phone\_numbers](#input\_fallback\_phone\_numbers) | List of international formatted phone number to send notification when lambda failed | `list(string)` | `[]` | no | | [health\_checks](#input\_health\_checks) | Health\_checks endpoints and paths | `any` | `[]` | no | @@ -72,7 +73,7 @@ No resources. | [name](#input\_name) | Dashboard name | `string` | n/a | yes | | [region](#input\_region) | The region where resources should be managed. In this repository it's secondary because IAM is always global. | `string` | `"eu-central-1"` | no | | [sns\_topic\_name](#input\_sns\_topic\_name) | SNS topic name | `string` | `"cloudwatch-alarm"` | no | -| [webhook\_url](#input\_webhook\_url) | Teams Webhook URL | `string` | n/a | yes | +| [webhook\_url](#input\_webhook\_url) | Teams Webhook URL | `string` | `""` | no | ## Outputs diff --git a/sns-topic.tf b/sns-topic.tf index cc51ada..2b2eabd 100644 --- a/sns-topic.tf +++ b/sns-topic.tf @@ -5,7 +5,7 @@ locals { } module "sns-to-teams-application-channel" { - count = var.create_application_channel ? 1 : 0 + count = var.enable_teams_notifications && var.create_application_channel ? 1 : 0 source = "./modules/cloudwatch-alarm-actions/" @@ -19,7 +19,7 @@ module "sns-to-teams-application-channel" { } module "sns-to-teams" { - count = var.create_alerts ? 1 : 0 + count = var.enable_teams_notifications && var.create_alerts ? 1 : 0 source = "./modules/cloudwatch-alarm-actions/" @@ -33,7 +33,7 @@ module "sns-to-teams" { } module "sns-to-teams-virginia" { - count = length(var.health_checks) > 0 ? 1 : 0 + count = var.enable_teams_notifications ? 1 : 0 source = "./modules/cloudwatch-alarm-actions/" diff --git a/vaiables.tf b/vaiables.tf index 0397364..a474437 100644 --- a/vaiables.tf +++ b/vaiables.tf @@ -47,11 +47,13 @@ variable "log_base_metrics" { variable "webhook_url" { type = string description = "Teams Webhook URL" + default = "" } variable "application_channel_webhook_url" { type = string description = "Application Teams Channel Webhook URL" + default = "" } variable "alerts" { @@ -89,3 +91,9 @@ variable "fallback_phone_numbers" { default = [] description = "List of international formatted phone number to send notification when lambda failed" } + +variable "enable_teams_notifications" { + type = bool + default = false + description = "Enable Teams notifications" +}