How do you provision Grafana data sources and dashboards as code?
⚡
Quick Answer
Drop YAML/JSON provisioning files under /etc/grafana/provisioning so they load on startup and can't be edited in the UI.
Detailed Answer
Provisioning makes a Grafana instance reproducible and disposable. Data sources go in provisioning/datasources/*.yml, dashboards in provisioning/dashboards/*.yml pointing at a folder of dashboard JSON. Provisioned objects are read-only in the UI, which prevents drift. For full GitOps you can also manage dashboards with the Terraform grafana provider or Grafonnet.
Code Example
apiVersion: 1
datasources:
- name: Prometheus
type: prometheus
access: proxy
url: http://prometheus:9090
isDefault: true💡
Interview Tip
Mention that provisioned resources are immutable in the UI — a feature, not a limitation.
grafanaprovisioninggitops