---
name: "grafana-dashboard-as-code"
description: "Version-control and generate dynamic Grafana dashboards using Jsonnet and Terraform."
metadata:
  author: "Grafana Labs"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "write grafana dashboard jsonnet"
  - "deploy grafana dashboard terraform"
  - "template variable grafana"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# Grafana Dashboards as Code with Grafonnet & Terraform

Develops Grafana dashboards as code: authoring templates using Grafonnet / Jsonnet, templated template variables (multi-cluster, namespace), alert rules, and deploying dashboards via Terraform Grafana provider.

## When to Invoke
Invoke this skill whenever you need to:
- write grafana dashboard jsonnet
- deploy grafana dashboard terraform
- template variable grafana

## Execution SOP & Rules
1. Install jsonnet and grafonnet libraries using jsonnet-bundler (jb).
2. Author dashboard.jsonnet importing grafonnet and defining row, time series panel, and variables.
3. Compile Jsonnet to JSON: jsonnet -J vendor dashboard.jsonnet > dashboard.json.
4. Provision dashboard using terraform with grafana_dashboard resource or Grafana provisioning folders.

## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.
