---
title: "Why deploy alerting resources with Terraform? | Grafana Labs"
description: "Learn how deploying a complete Grafana alerting pipeline as code using the Terraform provider can help you automate your processes."
---

> For a curated documentation index, see [llms.txt](/llms.txt). For the complete documentation index, see [llms-full.txt](/llms-full.txt).

# Why deploy alerting resources with Terraform?

You could create alert rules, contact points, and notification policies manually through the Grafana UI. But that means every update requires a manual step, there’s no audit trail, and you can’t reproduce the configuration consistently across environments.

Terraform solves this by treating alerting resources as infrastructure:

- **State management.** Terraform tracks what’s deployed. It knows whether to create a new alert rule or update an existing one.
- **Plan before apply.** Preview exactly what will change before any modification touches your Grafana instance.
- **One tool for everything.** If your team already uses Terraform for servers, networks, or cloud resources, adding alerting resources to the same workflow is natural.
- **Reproducible deployments.** The same `terraform apply` produces the same result every time, in every environment.
- **Audit trail.** Every deployment is tied to a Terraform state change, which you can track in version control.

## When Terraform is the right choice

Expand table

| Scenario                                               | Terraform fit                                              |
|--------------------------------------------------------|------------------------------------------------------------|
| Team already uses Terraform for infrastructure         | Excellent. Same workflow, same tool.                       |
| Need plan-and-apply safety for alerting changes        | Excellent. Preview before deploy.                          |
| Want to deploy alerting resources from CI/CD pipelines | Excellent. Integrates with GitHub Actions, GitLab CI, etc. |
| Just need a quick one-off alert rule                   | Consider the Grafana UI or exporting to HCL later          |

In the next milestone, you create a service account token that Terraform uses to authenticate to Grafana.
