Slide 6 of 6

Deploy an alert rule learning path

Learning path: Deploy an alert rule with Terraform

The following table describes the steps you’ll work through in the learning path.

StepWhat you’ll doOutcome
1. Why Terraform?Understand why Terraform is a natural fit for deploying alerting resourcesContext for choosing Terraform over manual workflows
2. Create a service accountSet up API credentials in Grafana for TerraformA service account token for authentication
3. Configure the providerDeclare the Grafana Terraform provider and authenticateTerraform connected to your Grafana instance
4. Define a folder and an alert rule groupCreate a folder to organize your alert rules, anda grafana_rule_group with a CPU usage alertAn organizational folder and alert rule ready to deploy in Grafana
5. Add a contact pointDefine a grafana_contact_point for Slack or emailA notification destination configured
6. Add a notification policyRoute alerts to the contact point based on labelsA complete alerting pipeline
7. Run terraform planPreview what Terraform will create in GrafanaConfidence in what will change before applying
8. Apply and verifyRun terraform apply and confirm the resources appear in GrafanaA live alerting pipeline deployed from code

Before you start

Have these ready before you open the path:

  • A Grafana Cloud account or self-managed Grafana instance (version 12 or higher)
  • Terraform installed (version 1.0 or later)
  • A data source configured in Grafana (for example, Prometheus or Grafana TestData)
  • Admin or Editor permissions on your Grafana instance
Learning path

Deploy an alert rule with Terraform

Deploy a complete Grafana alerting pipeline using the Terraform provider.

17 min
Advanced
Docs & blog posts

Open in Grafana Cloud

Complete this learning path directly in your Grafana Cloud stack, or in the Grafana Play stack, with an interactive learning experience.

Script

Time to put these concepts into practice. The learning path walks you through every step: creating a service account for authentication, configuring the Grafana Terraform provider, defining an alert rule group with contact point and notification policy, running terraform plan, and applying the changes to deploy your alerting pipeline.

Before you open the path, make sure you have Terraform installed and a Grafana instance ready. You’ll also need a data source configured in Grafana so the alert rule has metrics to query.