Skip to content

Latest commit

 

History

History
62 lines (43 loc) · 5.51 KB

File metadata and controls

62 lines (43 loc) · 5.51 KB

Terraform GCP Services Monitoring Module

This module creates a set of monitoring alerts for Google Cloud Platform services.

Supported services:

  • Cloud SQL

    • CPU usage
    • Storage usage
    • Memory usage
  • Kyverno

    • Error logs for admission-controller, background-controller, cleanup-controller, reports-controller
    • Metric threshold (optional)

Providers

Name Version
google >= 5.10

Requirements

Name Version
terraform >= 1.5
google >= 5.10

Inputs

Name Description Type Default Required
cloud_sql Configuration for Cloud SQL monitoring alerts. Supports customization of project, auto-close timing, notification channels, and per-instance alert thresholds for CPU, memory, and disk utilization.
object({
project_id = optional(string, null)
auto_close = optional(string, "86400s") # default 24h
notification_enabled = optional(bool, true)
notification_channels = optional(list(string), [])
instances = optional(map(object({
cpu_utilization = optional(list(object({
severity = optional(string, "WARNING"),
threshold = optional(number, 0.90)
alignment_period = optional(string, "120s")
duration = optional(string, "300s")
})), [
{
threshold = 0.85,
duration = "1200s",
},
{
severity = "CRITICAL",
threshold = 1,
duration = "300s",
alignment_period = "60s",
}
])
memory_utilization = optional(list(object({
severity = optional(string, "WARNING"),
threshold = optional(number, 0.90)
alignment_period = optional(string, "300s")
duration = optional(string, "300s")
})), [
{
severity = "WARNING",
},
{
severity = "CRITICAL",
threshold = 0.95,
}
])
disk_utilization = optional(list(object({
severity = optional(string, "WARNING"),
threshold = optional(number, 0.85)
alignment_period = optional(string, "300s")
duration = optional(string, "600s")
})), [
{
severity = "WARNING",
},
{
severity = "CRITICAL",
threshold = 0.95,
}
])
})), {})
})
n/a yes
kyverno Configuration for Kyverno monitoring alerts. Allows customization of cluster name, project, notification channels, alert documentation, metric thresholds, auto-close timing, enablement, extra filters, and namespace.
object({
enabled = optional(bool, true)
cluster_name = string
project_id = optional(string, null)
notification_enabled = optional(bool, true)
notification_channels = optional(list(string), [])
# Rate limit for notifications, e.g. "300s" for 5 minutes, used only for log match alerts
logmatch_notification_rate_limit = optional(string, "300s")
alert_documentation = optional(string, null)
auto_close_seconds = optional(number, 3600)
filter_extra = optional(string, "")
namespace = optional(string, "kyverno")
})
n/a yes
notification_channels List of notification channel IDs to notify when an alert is triggered list(string) [] no
project_id The Google Cloud project ID where logging exclusions will be created string n/a yes

Outputs

Name Description
cloud_sql_cpu_utilization n/a
cloud_sql_disk_utilization n/a
cloud_sql_memory_utilization n/a

Resources

Name Type
google_monitoring_alert_policy.cloud_sql_cpu_utilization resource
google_monitoring_alert_policy.cloud_sql_disk_utilization resource
google_monitoring_alert_policy.cloud_sql_memory_utilization resource
google_monitoring_alert_policy.kyverno_logmatch_alert resource

Modules

No modules.