Skip to content

TaitoUnited/terraform-google-monitoring

Repository files navigation

Google Cloud monitoring

Example usage:

provider "google" {
  project      = "my-infrastructure"
  region       = "europe-west1"
  zone         = "europe-west1-b"
}

resource "google_project_service" "compute" {
  service      = "compute.googleapis.com"
}

resource "google_project_service" "monitoring" {
  service      = "monitoring.googleapis.com"
}

module "monitoring" {
  source       = "TaitoUnited/monitoring/google"
  version      = "2.1.0"
  providers    = [ google ]
  depends_on   = [
    google_project_service.compute,
    google_project_service.monitoring,
  ]

  alerts       = yamldecode(file("${path.root}/../infra.yaml"))["alerts"]
}

Example YAML:

# NOTE: This module does not currently create notification channels.
# You have to create them manually (e.g. the 'monitoring' channel shown below).

alerts:
  - name: ingress-response-time
    type: log
    channels: [ "monitoring" ]
    rule: >
      resource.type = "k8s_container"
      resource.labels.namespace_name = "ingress-nginx"
      jsonPayload.responseTimeS >= 3
  - name: ingress-response-status
    type: log
    channels: [ "monitoring" ]
    rule: >
      resource.type = "k8s_container"
      resource.labels.namespace_name = "ingress-nginx"
      jsonPayload.status >= 500
  - name: container-errors
    type: log
    channels: [ "monitoring" ]
    rule: >
      resource.type = "k8s_container"
      severity >= ERROR

Combine with the following modules to get a complete infrastructure defined by YAML:

TIP: Similar modules are also available for AWS, Azure, and DigitalOcean. All modules are used by infrastructure templates of Taito CLI. See also Google Cloud project resources, Full Stack Helm Chart, and full-stack-template.

Contributions are welcome!

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages