Skip to content

grafana_dashboard produces 404 error if uid changes #2144

@paulojmdias

Description

@paulojmdias

Terraform Version

v1.9.8

Terraform Grafana Provider Version

v3.22.3

Grafana Version

No response

Affected Resource(s)

  • grafana_dashboard

Terraform Configuration Files

No response

Expected Behavior

No response

Actual Behavior

No response

Steps to Reproduce

  1. Try to create the resource without uid in config_json.
resource "grafana_dashboard" "test" {
  config_json = jsonencode({
    title = "UID Unset"
  })
}
  1. Try to change uid in config_json
resource "grafana_dashboard" "test" {
  config_json = jsonencode({
    title = "UID Unset"
    uid   = "uid-previously-unset"
  })
}
Terraform used the selected providers to generate the following execution plan. Resource
actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # grafana_dashboard.test will be updated in-place
  ~ resource "grafana_dashboard" "test" {
      ~ config_json  = jsonencode(
          ~ {
              + uid   = "uid-previously-unset"
                # (1 unchanged attribute hidden)
            }
        )
        id           = "0:eejwmu69kwiyoa"
        # (6 unchanged attributes hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.

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

grafana_dashboard.test: Modifying... [id=0:eejwmu69kwiyoa]
╷
│ Error: [POST /dashboards/db][404] postDashboardNotFound {"message":"Dashboard not found","status":"not-found"}
│
│   with grafana_dashboard.test,
│   on dash.tf line 20, in resource "grafana_dashboard" "test":
│   20: resource "grafana_dashboard" "test" {
│
╵

Important Factoids

No response

References

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions