# Service check resource "datadog_monitor" "service_check" { count = var.service_check_enabled ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Fargate service does not respond." message = coalesce(var.service_check_message, var.message) type = "service check" query = < ${var.cpu_utilization_threshold_critical} EOQ monitor_thresholds { critical = var.cpu_utilization_threshold_critical warning = var.cpu_utilization_threshold_warning } evaluation_delay = var.evaluation_delay new_host_delay = var.new_host_delay notify_no_data = false require_full_window = true renotify_interval = 0 notify_audit = false timeout_h = 0 include_tags = true locked = false tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:ecs_fargate", "team:claranet", "created-by:terraform"], var.cpu_utilization_extra_tags) } resource "datadog_monitor" "memory_utilization" { count = var.memory_utilization_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Fargate memory Utilization High {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = coalesce(var.memory_utilization_message, var.message) type = "metric alert" query = < ${var.memory_utilization_threshold_critical} EOQ monitor_thresholds { critical = var.memory_utilization_threshold_critical warning = var.memory_utilization_threshold_warning } evaluation_delay = var.evaluation_delay new_host_delay = var.new_host_delay notify_no_data = false require_full_window = true renotify_interval = 0 notify_audit = false timeout_h = 0 include_tags = true locked = false tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:ecs_fargate", "team:claranet", "created-by:terraform"], var.memory_utilization_extra_tags) }