95 lines
3.5 KiB
HCL
95 lines
3.5 KiB
HCL
resource "aws_cloudwatch_metric_alarm" "ngw-alarms" {
|
|
for_each = var.settings
|
|
alarm_name = "${var.cw-alarm-prefix}:NGW:${each.value["metric"]}:${var.res-id}"
|
|
comparison_operator = each.value["comparison_operator"]
|
|
evaluation_periods = each.value["evaluation_periods"]
|
|
metric_name = each.value["metric"]
|
|
period = each.value["period"]
|
|
statistic = each.value["statistic"]
|
|
threshold = each.value["threshold"]
|
|
alarm_description = "NGW:${each.value["metric"]}"
|
|
namespace = "AWS/NATGateway"
|
|
insufficient_data_actions = []
|
|
actions_enabled = var.actions-enabled
|
|
alarm_actions = [each.value["action"]]
|
|
ok_actions = [each.value["action"]]
|
|
dimensions = {
|
|
NatGatewayId = var.res-id
|
|
}
|
|
tags = var.default-tags
|
|
lifecycle {
|
|
ignore_changes = [tags]
|
|
}
|
|
}
|
|
|
|
|
|
/*
|
|
resource "aws_cloudwatch_metric_alarm" "ngw-ErrorPortAllocation" {
|
|
alarm_name = "${var.cw-alarm-prefix}:NGW:${var.settings.alarm1.metric}:${var.res-id}"
|
|
comparison_operator = "GreaterThanThreshold"
|
|
evaluation_periods = "2"
|
|
metric_name = var.settings.alarm1.metric
|
|
period = "300"
|
|
statistic = "Average"
|
|
threshold = var.settings.alarm1.threshold
|
|
alarm_description = "NGW:${var.settings.alarm1.metric}"
|
|
namespace = "AWS/NATGateway"
|
|
insufficient_data_actions = []
|
|
actions_enabled = var.actions-enabled
|
|
alarm_actions = [var.settings.alarm1.action]
|
|
ok_actions = [var.settings.alarm1.action]
|
|
dimensions = {
|
|
NatGatewayId = var.res-id
|
|
}
|
|
tags = var.default-tags
|
|
lifecycle {
|
|
ignore_changes = [tags]
|
|
}
|
|
}
|
|
|
|
resource "aws_cloudwatch_metric_alarm" "ngw-ConnectionEstablishedCount" {
|
|
alarm_name = "${var.cw-alarm-prefix}:NGW:${var.settings.alarm2.metric}:${var.res-id}"
|
|
comparison_operator = "GreaterThanThreshold"
|
|
evaluation_periods = "2"
|
|
metric_name = var.settings.alarm2.metric
|
|
period = "300"
|
|
statistic = "Average"
|
|
threshold = var.settings.alarm2.threshold
|
|
alarm_description = "NGW:${var.settings.alarm2.metric}"
|
|
namespace = "AWS/NATGateway"
|
|
insufficient_data_actions = []
|
|
actions_enabled = var.actions-enabled
|
|
alarm_actions = [var.settings.alarm2.action]
|
|
ok_actions = [var.settings.alarm2.action]
|
|
dimensions = {
|
|
NatGatewayId = var.res-id
|
|
}
|
|
tags = var.default-tags
|
|
lifecycle {
|
|
ignore_changes = [tags]
|
|
}
|
|
}
|
|
|
|
resource "aws_cloudwatch_metric_alarm" "ngw-PacketsDropCount" {
|
|
alarm_name = "${var.cw-alarm-prefix}:NGW:${var.settings.alarm3.metric}:${var.res-id}"
|
|
comparison_operator = "GreaterThanThreshold"
|
|
evaluation_periods = "2"
|
|
metric_name = var.settings.alarm3.metric
|
|
period = "300"
|
|
statistic = "Average"
|
|
threshold = var.settings.alarm3.threshold
|
|
alarm_description = "NGW:${var.settings.alarm3.metric}"
|
|
namespace = "AWS/NATGateway"
|
|
insufficient_data_actions = []
|
|
actions_enabled = var.actions-enabled
|
|
alarm_actions = [var.settings.alarm3.action]
|
|
ok_actions = [var.settings.alarm3.action]
|
|
dimensions = {
|
|
NatGatewayId = var.res-id
|
|
}
|
|
tags = var.default-tags
|
|
lifecycle {
|
|
ignore_changes = [tags]
|
|
}
|
|
}
|
|
*/ |