-
Notifications
You must be signed in to change notification settings - Fork 1
/
aws_cloudwatch_metric_alarm.tf
54 lines (45 loc) · 1.82 KB
/
aws_cloudwatch_metric_alarm.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
46
47
48
49
50
51
52
53
54
resource "aws_cloudwatch_metric_alarm" "this" {
count = var.create_metric_alarm ? 1 : 0
alarm_name = var.alarm_name
alarm_description = var.alarm_description
actions_enabled = var.actions_enabled
alarm_actions = var.alarm_actions
ok_actions = var.ok_actions
insufficient_data_actions = var.insufficient_data_actions
comparison_operator = var.comparison_operator
evaluation_periods = var.evaluation_periods
threshold = var.threshold
unit = var.unit
datapoints_to_alarm = var.datapoints_to_alarm
treat_missing_data = var.treat_missing_data
evaluate_low_sample_count_percentiles = var.evaluate_low_sample_count_percentiles
# conflicts with metric_query
metric_name = var.metric_name
namespace = var.namespace
period = var.period
statistic = var.statistic
extended_statistic = var.extended_statistic
dimensions = var.dimensions
# conflicts with metric_name
dynamic "metric_query" {
for_each = var.metric_query
content {
id = lookup(metric_query.value, "id")
label = lookup(metric_query.value, "label", null)
return_data = lookup(metric_query.value, "return_data", null)
expression = lookup(metric_query.value, "expression", null)
dynamic "metric" {
for_each = lookup(metric_query.value, "metric", [])
content {
metric_name = lookup(metric.value, "metric_name")
namespace = lookup(metric.value, "namespace")
period = lookup(metric.value, "period")
stat = lookup(metric.value, "stat")
unit = lookup(metric.value, "unit", null)
dimensions = lookup(metric.value, "dimensions", null)
}
}
}
}
tags = var.tags
}