2022-10-26 11:13:56 +08:00
|
|
|
data "aws_caller_identity" "this" {}
|
|
|
|
|
2023-01-05 23:35:31 +08:00
|
|
|
resource "aws_cloudwatch_metric_alarm" "ES-alarms" {
|
|
|
|
for_each = var.settings
|
|
|
|
alarm_name = "${var.cw-alarm-prefix}:ES:${each.value["metric"]}:${var.domain-name}"
|
|
|
|
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 = "ES:${each.value["metric"]}"
|
2022-10-26 11:13:56 +08:00
|
|
|
namespace = "AWS/ES"
|
|
|
|
insufficient_data_actions = []
|
|
|
|
actions_enabled = var.actions-enabled
|
2023-01-05 23:35:31 +08:00
|
|
|
alarm_actions = [each.value["action"]]
|
|
|
|
ok_actions = [each.value["action"]]
|
2022-12-19 14:45:23 +08:00
|
|
|
dimensions = {
|
|
|
|
DomainName = var.domain-name
|
|
|
|
ClientId = data.aws_caller_identity.this.id
|
|
|
|
}
|
|
|
|
tags = var.default-tags
|
|
|
|
lifecycle {
|
|
|
|
ignore_changes = [tags]
|
|
|
|
}
|
|
|
|
}
|