Documentationbreadcrumb arrow Grafana documentationbreadcrumb arrow As code and provisioning
Enterprise Open source Grafana Cloud
Managing Grafana with Terraform?
Deploy Grafana resources as Code with Terraform
Journey

Deploy, provision and manage Grafana with as code workflows

Manage resources, including folders and dashboards, and configurations with as code workflows.

Note

Looking for gcx? Have a look at the new AI tools section!

Overview of as code and provisioning

Provisioning and as code let you apply code management best practices to your observability resources. By representing Grafana resources as code, you can integrate them into existing infrastructure-as-code workflows and apply standard development practices. Instead of manually configuring dashboards or settings through the Grafana UI, you can:

  • Write configurations in code: Define dashboards in JSON or other supported formats.
  • Sync your Grafana setup to GitHub: Track changes, collaborate, and roll back updates using Git and GitHub, or other remote sources.
  • Automate with CI/CD: Integrate Grafana directly into your development and deployment pipelines.
  • Standardize workflows: Ensure consistency across your teams by using repeatable, codified processes for managing Grafana resources.

Note

For basic configuration provisioning refer to Provision Grafana.

Explore

Explore the available as code tools. Most can be used with one another.

Choose a tool

Use the following table to find the tool that fits your workflow. You can combine tools, but give each resource a single owner so that one tool doesn’t overwrite changes made by another.

I want toUseWhy
Manage Grafana Cloud stacks and resources across Grafana products from one configurationTerraformThe Grafana Terraform provider supports the most Grafana resources, and fits Terraform workflows such as reviewing changes with terraform plan and applying them from CI/CD.
Edit dashboards in the Grafana UI and store them in GitGit SyncGit Sync synchronizes dashboard files between a GitHub repository and Grafana, with version control, branching, and pull requests directly from Grafana.
Load dashboards and folders from files on the server that runs GrafanaOn-prem file provisioningGrafana reads the resources from a local file system, so you don’t need external tooling.
Manage Grafana Cloud resources from Ansible playbooksAnsibleThe Grafana Ansible collection manages Grafana Cloud resources, including folders and cloud stacks, alongside the rest of your Ansible automation.
Run Grafana in Kubernetes and manage its resources as custom resourcesGrafana OperatorThe Grafana Operator provisions and operates Grafana instances and manages their dashboards, folders, and data sources through Kubernetes custom resources.
Define any Terraform-supported resource as a Kubernetes manifestGrafana Crossplane providerThe Crossplane provider is built from the Terraform provider and supports all of its resources, so it fits GitOps pipelines built on tools like Argo CD.
Generate dashboards from codeFoundation SDKYou define dashboards in Go, TypeScript, Python, Java, or PHP, and push the generated resources with gcx.
Inspect, pull, and push resources from the command line or with an AI agentGrafana CLIgcx manages resources across Grafana and Grafana Cloud with one set of commands, and works for both people and agents.

Additional as code tools

gcx is the Grafana command-line tool for provisioning Grafana and Grafana Cloud resources. You can also provision resources with other AI tools:

  • Grafana Assistant: Create and update dashboards in plain language, directly in the Grafana UI. Refer to Grafana Assistant.
  • MCP servers: Let an external AI client, such as Claude, Cursor, or VS Code with Copilot, manage dashboards, folders, alerting, and other resources through the Model Context Protocol. Refer to MCP server.

These tools work well for exploring and drafting changes. To keep changes durable, move them into version-controlled files and apply them with gcx or another as-code tool. For a comparison of the AI tools, refer to AI tools.

Grafonnet is a Jsonnet library for generating Grafana dashboard JSON definitions programmatically. Grafonnet is not officially supported by Grafana. Instead, use the Foundation SDK to create dashboards as code.

Grizzly has been removed, and is no longer deployed, enhanced, or supported. Use gcx instead.