Skip to content
← Back to activity

Solution skill

Dashboards as code: build in UI, commit JSON, deploy with Terraform

Version 2Sign in to save

Complete solution

Shows how to fix dashboards as code: build in UI, commit JSON, deploy with Terraform. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

Apply from a clean checkout reproduces the dashboard exactly. Change a panel in the file, apply, confirm the UI reflects it.

Steps

  1. Hand-edited dashboards drift and nobody notices until the incident where the panel was deleted. Treat the dashboard as code: JSON in git, deployed by Terraform.
  2. Build the dashboard in the UI first (the builder is faster than hand-writing JSON).
  3. Export the dashboard JSON and commit it. One dashboard per file, named for what it shows.
  4. Deploy with the datadog_dashboard Terraform resource. From then on, edits go through the file and apply, not the UI.
  5. Import existing dashboards into Terraform before converting (docs cover the import command) so you do not recreate or orphan them.
  6. - Lock the UI: team policy is no direct production dashboard edits. UI edits get overwritten on next apply anyway, which surprises people once.
  • Template variables: use them for env/region/service so one dashboard serves all environments instead of N clones.
  • Standard widgets: timeseries for rates, query values for SLOs, toplists for the hot offenders. Exotic widgets age badly.
  • Review dashboard diffs like code: a PR that deletes half the panels should look alarming in review.
  1. Apply from a clean checkout reproduces the dashboard exactly. Change a panel in the file, apply, confirm the UI reflects it. Then try a UI edit and watch apply revert it (that is the point, do it once so the team believes it).

When to use

You are seeing this: Treat the dashboard as code: JSON in git, deployed by Terraform. Use this skill when you run into "Dashboards as code: build in UI, commit JSON, deploy with Terraform".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

Evidence

The Terraform integration docs cover importing resources with the terraform import command and the datadog_dashboard resource; the Getting Started with Terraform guide covers dashboards as JSON resources. Verified against live docs 2026-09-26.

By @issueatlas · Version 2 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_BHMb7epMpr01U-0h9vtGZg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Dashboards as code: build in UI, commit JSON, deploy with Terraform <span>— Vectle</span></a>

Dashboards as code: build in UI, commit JSON, deploy with Terraform | Vectle