resource "datadog_monitor" "apimgt_status" { count = "${var.status_enabled ? 1 : 0}" name = "[${var.environment}] API Management is down" message = "${coalesce(var.status_message, var.message)}" query = < ${var.failed_requests_threshold_critical} EOF thresholds { critical = "${var.failed_requests_threshold_critical}" warning = "${var.failed_requests_threshold_warning}" } silenced = "${var.failed_requests_silenced}" type = "metric alert" notify_no_data = false notify_audit = false timeout_h = 1 include_tags = true locked = false require_full_window = false new_host_delay = "${var.new_host_delay}" evaluation_delay = "${var.evaluation_delay}" renotify_interval = 0 tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:apimanagement", "team:claranet", "created-by:terraform", "${var.failed_requests_extra_tags}"] } resource "datadog_monitor" "apimgt_other_requests" { count = "${var.other_requests_enabled ? 1 : 0}" name = "[${var.environment}] API Management too many other requests {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = "${coalesce(var.other_requests_message, var.message)}" query = < ${var.other_requests_threshold_critical} EOF thresholds { critical = "${var.other_requests_threshold_critical}" warning = "${var.other_requests_threshold_warning}" } silenced = "${var.other_requests_silenced}" type = "metric alert" notify_no_data = false notify_audit = false timeout_h = 1 include_tags = true locked = false require_full_window = false new_host_delay = "${var.new_host_delay}" evaluation_delay = "${var.evaluation_delay}" renotify_interval = 0 tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:apimanagement", "team:claranet", "created-by:terraform", "${var.other_requests_extra_tags}"] } resource "datadog_monitor" "apimgt_unauthorized_requests" { count = "${var.unauthorized_requests_enabled ? 1 : 0}" name = "[${var.environment}] API Management too many unauthorized requests {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = "${coalesce(var.unauthorized_requests_message, var.message)}" query = < ${var.unauthorized_requests_threshold_critical} EOF thresholds { critical = "${var.unauthorized_requests_threshold_critical}" warning = "${var.unauthorized_requests_threshold_warning}" } silenced = "${var.unauthorized_requests_silenced}" type = "metric alert" notify_no_data = false notify_audit = false timeout_h = 1 include_tags = true locked = false require_full_window = false new_host_delay = "${var.new_host_delay}" evaluation_delay = "${var.evaluation_delay}" renotify_interval = 0 tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:apimanagement", "team:claranet", "created-by:terraform", "${var.unauthorized_requests_extra_tags}"] } resource "datadog_monitor" "apimgt_successful_requests" { count = "${var.successful_requests_enabled ? 1 : 0}" name = "[${var.environment}] API Management successful requests rate too low {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = "${coalesce(var.successful_requests_message, var.message)}" query = <