Apply and verify

With the plan confirmed, you can now apply it to deploy your dashboard to Grafana.

To deploy and verify your dashboard, complete the following steps:

  1. Run terraform apply:

    Bash
    terraform apply
  2. Terraform displays the plan again and asks for confirmation. Type yes and press Enter:

    Do you want to perform these actions?
      Terraform will perform the actions described above.
      Only 'yes' will be accepted to approve.
    
      Enter a value: yes
  3. Wait for Terraform to complete. You should see:

    Apply complete! Resources: 2 added, 0 changed, 0 destroyed.
  4. Open your Grafana instance in a browser and navigate to Dashboards in the left-side menu.

  5. Look for the Dashboards as Code folder. Click into it.

  6. Confirm your dashboard appears with the title My SDK Dashboard (or whatever title you set in the JSON).

  7. Open the dashboard and verify the panels render correctly.

Updating a deployed dashboard

When you modify your dashboard JSON and run terraform apply again, Terraform detects the change and updates the existing dashboard in place. No duplicates, no manual intervention.

Bash
# After modifying dashboard.json:
terraform plan    # Preview the update
terraform apply   # Apply the update

What Terraform state tracks

Terraform stores the deployed resource IDs in its state file (terraform.tfstate). This is how it knows whether to create or update a dashboard on subsequent runs. Keep the state file safe. If you lose it, Terraform won’t know about existing resources.

Your dashboard is now deployed and managed by Terraform.

Were you successful?


page 7 of 8