From c842f7a63ade60b10da3a70930227aca5f780b1b Mon Sep 17 00:00:00 2001 From: "Luis M. Gallardo D" Date: Mon, 25 Oct 2021 00:46:36 -0300 Subject: [PATCH] Add support to SNS Topic for SMS --- root/us-east-1/notifications/config.tf | 4 ++++ .../notifications/sms_tools_monitoring.tf | 22 +++++++++++++++++++ root/us-east-1/notifications/variables.tf | 5 +++++ 3 files changed, 31 insertions(+) create mode 100644 root/us-east-1/notifications/sms_tools_monitoring.tf diff --git a/root/us-east-1/notifications/config.tf b/root/us-east-1/notifications/config.tf index 156015828..6ef6f38c2 100644 --- a/root/us-east-1/notifications/config.tf +++ b/root/us-east-1/notifications/config.tf @@ -57,3 +57,7 @@ data "terraform_remote_state" "keys" { data "vault_generic_secret" "slack_hook_url_monitoring" { path = "secrets/${var.project}/${var.environment}/notifications" } + +data "vault_generic_secret" "notifications" { + path = "secrets/${var.project}/${var.environment}/notifications" +} diff --git a/root/us-east-1/notifications/sms_tools_monitoring.tf b/root/us-east-1/notifications/sms_tools_monitoring.tf new file mode 100644 index 000000000..5e52c0134 --- /dev/null +++ b/root/us-east-1/notifications/sms_tools_monitoring.tf @@ -0,0 +1,22 @@ +module "sns" { + source = "github.com/binbashar/terraform-aws-sns-topic.git?ref=0.19.2" + + name = var.sns_topic_name_sms + + subscribers = { + phone1 = { + protocol = "sms" + endpoint = data.vault_generic_secret.notifications.data["phone1"] + } + #phone2 = { + # protocol = "sms" + # endpoint = data.vault_generic_secret.notifications.data["phone2"] + #} + #phone3 = { + # protocol = "sms" + # endpoint = data.vault_generic_secret.notifications.data["phone3"] + #} + } + + sqs_dlq_enabled = false +} diff --git a/root/us-east-1/notifications/variables.tf b/root/us-east-1/notifications/variables.tf index cbbcd3b66..fc463ebd9 100644 --- a/root/us-east-1/notifications/variables.tf +++ b/root/us-east-1/notifications/variables.tf @@ -104,6 +104,11 @@ variable "sns_topic_name_monitoring_sec" { default = "sns-topic-slack-notify-monitoring-sec" } +variable "sns_topic_name_sms" { + description = "" + default = "sns-topic-sms" +} + #=============================# # Hashicorp Vault Vars # #=============================#