Skip to content

Commit

Permalink
Add notification_emails variable for subscribing to alarms
Browse files Browse the repository at this point in the history
  • Loading branch information
rotciw committed Apr 8, 2024
1 parent aac1b49 commit 186c52e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
8 changes: 8 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,12 @@ resource "aws_ce_anomaly_subscription" "mainsubscription" {
type = "EMAIL"
address = "[email protected]"
}

dynamic "subscriber" {
for_each = var.notification_emails
content {
type = "EMAIL"
address = subscriber.value
}
}
}
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
}

0 comments on commit 186c52e

Please sign in to comment.