diff --git a/internal/resources/grafana/resource_dashboard.go b/internal/resources/grafana/resource_dashboard.go index 5d543afa3..47054c04e 100644 --- a/internal/resources/grafana/resource_dashboard.go +++ b/internal/resources/grafana/resource_dashboard.go @@ -361,9 +361,8 @@ func NormalizeDashboardConfigJSON(config interface{}) string { // similarly to uid removal above, remove any attributes panels[].libraryPanel.* // from the dashboard JSON other than "name" or "uid". // Grafana will populate all other libraryPanel attributes, so delete them to avoid diff. - panels, hasPanels := dashboardJSON["panels"] - if hasPanels { - for _, panel := range panels.([]interface{}) { + if panels, ok := dashboardJSON["panels"].([]interface{}); ok { + for _, panel := range panels { panelMap := panel.(map[string]interface{}) delete(panelMap, "id") if libraryPanel, ok := panelMap["libraryPanel"].(map[string]interface{}); ok {