From 186c52e448792391d4395be56fd527bdb4a19c3b Mon Sep 17 00:00:00 2001 From: Wictor Zhao Date: Mon, 8 Apr 2024 09:55:56 +0200 Subject: [PATCH] Add `notification_emails` variable for subscribing to alarms --- main.tf | 8 ++++++++ variables.tf | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/main.tf b/main.tf index a26cc60..5f09338 100644 --- a/main.tf +++ b/main.tf @@ -50,4 +50,12 @@ resource "aws_ce_anomaly_subscription" "mainsubscription" { type = "EMAIL" address = "aws-budget-alarms-email.obdw3nwx@vyutv.pagerduty.com" } + + dynamic "subscriber" { + for_each = var.notification_emails + content { + type = "EMAIL" + address = subscriber.value + } + } } diff --git a/variables.tf b/variables.tf index 0964401..e547290 100644 --- a/variables.tf +++ b/variables.tf @@ -17,3 +17,9 @@ variable "anomaly_threshold_percentage" { description = "Anomaly in cost above this percentage." default = "100" } + +variable "notification_emails" { + description = "Emails to notify when the alarm is triggered." + type = list(string) + default = [] +} \ No newline at end of file