Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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)

Code Block
# 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

...

  # uncomment to force apply. 
  # overwrite = true
}

Note: In case of failures to apply the state due to conflict in the dashboard (this can happen if the dashboard already exists or there’s a UID clash. Force the import using overwrite flag.

Add Alerting Resources to Terraform

...