- Documentation
- Learning Hub
- Deploy Grafana resources as Code with Terraform
- Grafana resources and Terraform
Grafana resources in Terraform
The Grafana Terraform provider
Terraform uses HashiCorp Configuration Language (HCL), an open-source toolkit to define infrastructure and resources as code.
The Grafana Terraform provider is the bridge between your Terraform configuration and the Grafana API. It handles authentication, resource lifecycle management, and state tracking. You declare it in your configuration and authenticate with your Grafana instance URL and a service account token.
terraform {
required_providers {
grafana = {
source = "grafana/grafana"
version = ">= 2.9.0"
}
}
}
provider "grafana" {
url = var.grafana_url
auth = var.grafana_token
}Core Grafana infrastructure resources with Terraform
The provider manages a wide range of resources. These are the some of the resources used for a Grafana instance.
Grafana Cloud resources with Terraform
For Grafana Cloud, additional resources manage stack-level configuration.