Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

If you use terraform as a PaaS tool and part of your gitops/CD, your dashboards and alerts (custom as well as ones you install using catalog service). Using terraform with kloudfuse is same as using it with grafana for the dashboards and alerts.

Terraform provider definition

Create a terraform resource file kfuse.tf and add a provider resource with terraform using following info (make sure to change url and auth as required):

terraform {
    required_providers {
        grafana = {
            source = "grafana/grafana"
            version = ">= 1.40.1"
        }
    }
}

provider "grafana" {
    url = "https://<your-kloudfuse-access-url>/grafana"
    auth = "admin:password"
    # use following format if using api key
    #auth = "glsa_n1BPVVcnBiDvhu3PmgrvpRJF47vl8MfO_cbb375b2"
}

Add Dashboard Resources to Terraform

Once initialized the dashboards and alerts have to be imported into this terraform instance. Importing dashboards is rather easy and can be done by simply adding following resource in your kfuse.tf file. The example below shows how to import all dashboards within a custom folder custom_db_folder (as described in the documentation here)

# Create folder custom_db_folder
# 
resource "grafana_folder" "custom_db_folder" {
  provider = grafana
  title = "my custom folder"
}

# Add all dashboards 
resource "grafana_dashboard" "custom-dbs" {
  provider = grafana

  for_each    = fileset("${path.module}/<path-to-custom-db-folder>", "*.json")
  config_json = file("${path.module}/<path-to-custom-db-folder>/${each.key}")
  folder      = grafana_folder.custom_db_folder.id
}

Add Alerting Resources to Terraform

Configuring alerting related resources into terraform has following steps. Each related resource has to be explicitly configured. Currently, there’s no file base load support (similar to dashboards)

Add Contact Points & Templates to Terraform

For each contact point which needs to be managed and optionally associated message template as a terraform resource execute following steps.

Add Notification Policy to Terraform

Notification policies are maintained as a single object. Follow these steps to configure terraform to manage notification policies.

Add Alert Rules to Terraform

For managing alert rules with terraform, follow these steps for each rule group.

  • No labels