From the course: Prometheus and Grafana: Visualizing Application Performance
Unlock this course with a free trial
Join today to access over 24,900 courses taught by industry experts.
Defining a dashboard with Terraform
From the course: Prometheus and Grafana: Visualizing Application Performance
Defining a dashboard with Terraform
- [Instructor] Now that we have our provider set up, we can use Terraform to create dashboards both in Grafana Cloud and locally. To get that going, we'll add some new code. The first thing we'll do is add a service account for the Grafana stack. This will create an account in Grafana that can make the changes requested by Terraform. We'll then declare a new stack provider, which will actually be used to create the resources. Next, we can add resources in a new resources.tf file. The first thing we'll need to do is define our Prometheus data source in Terraform. For Grafana Cloud, the main thing we need is a way to retrieve the Prometheus URL. For that, we use the Grafana data source resource. This Terraform resource allows you to query information about your Grafana Cloud stack, including the Prometheus endpoint. We then reference the URL property when creating the Terraform resource. Next, we can then add in Grafana dashboard resource. Before we do that though, for Grafana open…