forked from dwp/terraform-aws-metric-filter-alarm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
22 lines (21 loc) · 785 Bytes
/
main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
resource "aws_cloudwatch_log_metric_filter" "metric_filter" {
log_group_name = var.log_group_name
metric_transformation {
name = "${var.metric_filter_name != "" ? var.metric_filter_name : var.alarm_name}"
namespace = var.metric_namespace
value = "1"
}
name = "${var.metric_filter_name != "" ? var.metric_filter_name : var.alarm_name}"
pattern = var.pattern
}
resource "aws_cloudwatch_metric_alarm" "metric_alarm" {
alarm_name = var.alarm_name
comparison_operator = var.comparison_operator
evaluation_periods = var.evaluation_periods
metric_name = aws_cloudwatch_log_metric_filter.metric_filter.name
namespace = var.metric_namespace
period = var.period
threshold = var.threshold
statistic = var.statistic
alarm_actions = var.alarm_action_arns
}