ncabatoff / grafana-hashiprov

Deploy Grafana for Prometheus using Terraform, Nomad, and Consul

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

grafana-hashiprov: Provision static Grafana using HashiCorp tools.

This repo solves the problem of how to deploy Grafana and configure it with datasources and dashboards, where:

  • the datasources are Prometheus servers registered in Consul
  • you want Grafana to run as a Nomad job
  • you have Consul DNS available in your environment
  • you want to store your dashboards in a Git repo

Neither the datasources nor dashboards will be modifiable via the Grafana UI. This is a feature.

Usage

Put your dashboards into a repo, e.g. https://github.com/ncabatoff/grafana-dashboards.

terraform init
terraform apply

When you want to update the dashboards, repeat the above. The existing Grafana job will be stopped and a new one created with the updated provisioning.

Caveats

1. Nomad Provider

This relies on the Terraform Nomad Provider. This may not suit your production needs due to Issue #1: if changes are made to the Nomad job outside of Terraform, Terraform won't know.

Workaround if you ever get into a bad state:

  • stop the Nomad job, then
  • terraform destroy -target=nomad_job.grafana
  • terraform apply

About

Deploy Grafana for Prometheus using Terraform, Nomad, and Consul

License:MIT License


Languages

Language:HCL 100.0%