generated from production-ready-toolkit/terraform-module-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcloudwatch.tf
45 lines (36 loc) · 1.42 KB
/
cloudwatch.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
resource "aws_cloudwatch_metric_alarm" "warn" {
alarm_name = format("%s-aws-billing-%s-warn", var.project, var.environment)
comparison_operator = "GreaterThanOrEqualToThreshold"
evaluation_periods = "1"
metric_name = "EstimatedCharges"
namespace = "AWS/Billing"
period = var.evaluation_period
statistic = "Maximum"
alarm_actions = [
var.sns_topic_warn == null ? aws_sns_topic.warn[0].arn : var.sns_topic_warn
]
dimensions = {
Currency = lookup(var.warn, "Currency")
LinkedAccount = var.linked_account
}
threshold = lookup(var.warn, "Amount")
tags = var.tags
}
resource "aws_cloudwatch_metric_alarm" "danger" {
alarm_name = format("%s-aws-billing-%s-danger", var.project, var.environment)
comparison_operator = "GreaterThanOrEqualToThreshold"
evaluation_periods = "1"
metric_name = "EstimatedCharges"
namespace = "AWS/Billing"
period = var.evaluation_period
statistic = "Maximum"
alarm_actions = [
var.sns_topic_warn == null ? aws_sns_topic.danger[0].arn : var.sns_topic_danger
]
dimensions = {
Currency = lookup(var.danger, "Currency")
LinkedAccount = var.linked_account
}
threshold = lookup(var.danger, "Amount")
tags = var.tags
}