Sazabi
Terraform provider

sazabi_dashboard

Terraform resource for a saved Sazabi project dashboard.

Manages a saved project dashboard as code. The dashboard's source file is kept beside your configuration, and every apply that changes the source or its files publishes the next revision. Destroying the resource deletes the dashboard. See Dashboards for what a dashboard file contains, example files, and how to check a file with sazabi dashboards validate.

A change made to the dashboard outside Terraform shows up in the next plan, and the next apply replaces it with your configuration. If the dashboard changes between your plan and apply, the apply or destroy stops with a conflict instead of overwriting it; run it again.

Example

resource "sazabi_dashboard" "service_health" {
  project_id = sazabi_project.production.id
  source     = file("${path.module}/dashboards/service-health.mdx")

  # Static data a panel reads from a file, keyed by the path the source names:
  # files = {
  #   "owners.json" = file("${path.module}/dashboards/owners.json")
  # }
}

Arguments

AttributeTypeBehaviorDescription
sourcestringRequiredThe complete dashboard source (at most 80,000 characters), usually read with file(). An edit marker written by sazabi dashboards get --out is ignored.
project_idstringOptional, ComputedOwning project. Defaults to the secret key's project scope; required when the secret key is organization-scoped. Changing it forces replacement.
filesmap(string)OptionalStatic panel files the source names with path="…", keyed by that relative path (for example owners.json). Each value is the file's complete JSON, including its version and type (see sazabi dashboards validate --example static-file), usually from file() or jsonencode(). Live queries stay in the source.
titlestringComputedTitle from the source's DashboardMeta.
descriptionstringComputedDescription from the source's DashboardMeta.
revisionnumberComputedCurrent published revision.
definition_hashstringComputedSHA-256 digest of the source and files. A change made outside Terraform shows up as drift here.
idstringComputedDashboard ID.

Import

Import by <project-id>/<dashboard-id>. With a secret key scoped to a single project, the dashboard ID alone also works.

terraform import sazabi_dashboard.service_health your-project-id/your-dashboard-id