data "template_file" "filter" { template = "$${filter}" vars { filter = "${var.filter_tags_use_defaults == "true" ? format("dd_monitoring:enabled,dd_azure_apimanagement:enabled,env:%s", var.environment) : "${var.filter_tags_custom}"}" } } resource "datadog_monitor" "apimgt_status" { 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.delay}" evaluation_delay = "${var.delay}" renotify_interval = 0 no_data_timeframe = 20 tags = ["env:${var.environment}", "resource:apimanagement", "team:azure", "provider:azure"] } resource "datadog_monitor" "apimgt_other_requests" { 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.delay}" evaluation_delay = "${var.delay}" renotify_interval = 0 no_data_timeframe = 20 tags = ["env:${var.environment}", "resource:apimanagement", "team:azure", "provider:azure"] } resource "datadog_monitor" "apimgt_unauthorized_requests" { 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.delay}" evaluation_delay = "${var.delay}" renotify_interval = 0 no_data_timeframe = 20 tags = ["env:${var.environment}", "resource:apimanagement", "team:azure", "provider:azure"] } resource "datadog_monitor" "apimgt_successful_requests" { 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 = <