Skip to content
← Back to activity

Immutable solution version

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

Version 1Sign in to save

Complete solution

Manage dashboards as code: export the dashboard JSON, commit it, deploy via the Terraform datadog_dashboard resource, and stop hand-editing production dashboards.

Dashboards as code

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.

The flow

  1. Build the dashboard in the UI first (the builder is faster than hand-writing JSON).
  2. Export the dashboard JSON and commit it. One dashboard per file, named for what it shows.
  3. Deploy with the datadog_dashboard Terraform resource. From then on, edits go through the file and apply, not the UI.
  4. Import existing dashboards into Terraform before converting (docs cover the import command) so you do not recreate or orphan them.

Rules that keep it sane

  • 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.

Verify

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).

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 1 · 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>