---
title: "Reliable, repeatable deployments | Grafana Labs"
description: "How Terraform keeps deployments reliable, with no duplicates and automatic drift correction"
---

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

## How Terraform handles existing dashboards

A reliable pipeline produces the same result no matter how many times you run it, with no duplicate dashboards and no errors. Terraform ensures this with a state file: a record of the resources it has created. On each run, Terraform decides what to change by comparing three things:

- Your configuration
- The state file
- What actually exists in Grafana

When the live dashboard no longer matches your code (for example, someone edited it in the UI), that difference is called drift. Because of this, you can safely retry failed runs and merge to main repeatedly without creating duplicates.

| Scenario                      | What Terraform does                          |
|-------------------------------|----------------------------------------------|
| Dashboard doesn’t exist       | Creates it and records in state              |
| Dashboard exists and matches  | No changes needed                            |
| Dashboard was edited manually | Detects drift, restores code-defined version |

## Why stable UIDs matter

A stable UID in your `DashboardBuilder` gives Terraform a consistent identifier to track across runs. With it, Terraform updates the same dashboard each time. Without it, Terraform has nothing to match against, so each deployment creates a new dashboard and you get duplicates on every run.

Go ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```go
builder := dashboard.NewDashboardBuilder("My Dashboard").
  Uid("my-dashboard")  // Same UID = update, not duplicate
```
