From 16af38164987b7a3d96bdcfbaf2cc953594a1a85 Mon Sep 17 00:00:00 2001 From: Julia Aghamyan Date: Tue, 15 Aug 2023 10:51:14 +0400 Subject: [PATCH] fix(DMVP-changes): Changed module sns topic created in account module --- README.md | 16 +----------- health-checks-and-alerts.tf | 15 ++++------- output.tf | 11 -------- sns-topic.tf | 50 ------------------------------------- vaiables.tf | 36 -------------------------- 5 files changed, 6 insertions(+), 122 deletions(-) delete mode 100644 output.tf delete mode 100644 sns-topic.tf diff --git a/README.md b/README.md index e03ca9d..4f59356 100644 --- a/README.md +++ b/README.md @@ -40,14 +40,10 @@ No providers. | Name | Source | Version | |------|--------|---------| | [alerts](#module\_alerts) | ./modules/alerts/ | n/a | -| [alerts\_application\_channel](#module\_alerts\_application\_channel) | ./modules/alerts/ | n/a | | [aws\_cloudwatch\_log\_metric\_filter](#module\_aws\_cloudwatch\_log\_metric\_filter) | dasmeta/modules/aws//modules/cloudwatch-log-metric | 1.7.0 | | [eks\_monitoring\_dashboard](#module\_eks\_monitoring\_dashboard) | ./modules/dashboard/ | n/a | | [health-check](#module\_health-check) | ./modules/alerts/ | n/a | | [monitoring\_dashboard](#module\_monitoring\_dashboard) | ./modules/dashboard/ | n/a | -| [sns-to-teams](#module\_sns-to-teams) | ./modules/cloudwatch-alarm-actions/ | n/a | -| [sns-to-teams-application-channel](#module\_sns-to-teams-application-channel) | ./modules/cloudwatch-alarm-actions/ | n/a | -| [sns-to-teams-virginia](#module\_sns-to-teams-virginia) | ./modules/cloudwatch-alarm-actions/ | n/a | ## Resources @@ -59,27 +55,17 @@ 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` | `""` | 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 | | [log\_base\_metrics](#input\_log\_base\_metrics) | Log Base Metrics | `any` | `[]` | no | | [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` | `""` | no | ## Outputs -| Name | Description | -|------|-------------| -| [sns\_topic\_arn](#output\_sns\_topic\_arn) | n/a | -| [sns\_topic\_arn\_application\_channel](#output\_sns\_topic\_arn\_application\_channel) | n/a | -| [sns\_topic\_arn\_virginia](#output\_sns\_topic\_arn\_virginia) | n/a | +No outputs. diff --git a/health-checks-and-alerts.tf b/health-checks-and-alerts.tf index 85eb157..3c840a8 100644 --- a/health-checks-and-alerts.tf +++ b/health-checks-and-alerts.tf @@ -1,3 +1,8 @@ +locals { + sns_topic_name = var.sns_topic_name + sns_topic_name_virginia = "${var.sns_topic_name}-virginia" +} + module "health-check" { source = "./modules/alerts/" count = length(var.health_checks) > 0 ? 1 : 0 @@ -20,13 +25,3 @@ module "alerts" { sns_topic = local.sns_topic_name alerts = var.alerts } - - -module "alerts_application_channel" { - source = "./modules/alerts/" - - count = var.create_application_channel ? 1 : 0 - - sns_topic = local.sns_topic_name - alerts = var.application_channel_alerts -} diff --git a/output.tf b/output.tf deleted file mode 100644 index 3ecb7fc..0000000 --- a/output.tf +++ /dev/null @@ -1,11 +0,0 @@ -output "sns_topic_arn" { - value = module.sns-to-teams[*].topic_arn -} - -output "sns_topic_arn_virginia" { - value = module.sns-to-teams[*].topic_arn -} - -output "sns_topic_arn_application_channel" { - value = module.sns-to-teams[*].topic_arn -} diff --git a/sns-topic.tf b/sns-topic.tf deleted file mode 100644 index 2b2eabd..0000000 --- a/sns-topic.tf +++ /dev/null @@ -1,50 +0,0 @@ -locals { - sns_topic_name = "${var.sns_topic_name}-${var.region}" - sns_topic_application_channel = "${var.sns_topic_name}-application" - sns_topic_name_virginia = "${var.sns_topic_name}-virginia" -} - -module "sns-to-teams-application-channel" { - count = var.enable_teams_notifications && var.create_application_channel ? 1 : 0 - - source = "./modules/cloudwatch-alarm-actions/" - - topic_name = local.sns_topic_application_channel - - fallback_email_addresses = var.fallback_email_addresses - fallback_phone_numbers = var.fallback_phone_numbers - teams_webhooks = [var.application_channel_webhook_url] - enable_dead_letter_queue = false - recreate_missing_package = false -} - -module "sns-to-teams" { - count = var.enable_teams_notifications && var.create_alerts ? 1 : 0 - - source = "./modules/cloudwatch-alarm-actions/" - - topic_name = local.sns_topic_name - - fallback_email_addresses = var.fallback_email_addresses - fallback_phone_numbers = var.fallback_phone_numbers - teams_webhooks = [var.webhook_url] - enable_dead_letter_queue = false - recreate_missing_package = false -} - -module "sns-to-teams-virginia" { - count = var.enable_teams_notifications ? 1 : 0 - - source = "./modules/cloudwatch-alarm-actions/" - - topic_name = local.sns_topic_name_virginia - - fallback_email_addresses = var.fallback_email_addresses - fallback_phone_numbers = var.fallback_phone_numbers - teams_webhooks = [var.webhook_url] - enable_dead_letter_queue = false - recreate_missing_package = false - providers = { - aws = aws.virginia - } -} diff --git a/vaiables.tf b/vaiables.tf index a474437..4553ea0 100644 --- a/vaiables.tf +++ b/vaiables.tf @@ -21,12 +21,6 @@ variable "create_alerts" { description = "Create Alert" } -variable "create_application_channel" { - type = bool - default = true - description = "Create application alert" -} - variable "sns_topic_name" { type = string default = "cloudwatch-alarm" @@ -44,18 +38,6 @@ variable "log_base_metrics" { description = "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" { type = any default = [] @@ -79,21 +61,3 @@ variable "application_monitroing_dashboard" { default = [] description = "Application for monitoring EKS cluster" } - -variable "fallback_email_addresses" { - type = list(string) - default = [] - description = "List of fallback email addresses to send notification when lambda failed" -} - -variable "fallback_phone_numbers" { - type = list(string) - 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" -}