Skip to content

Commit

Permalink
fix: Fix dashboard naming rule in hcl file
Browse files Browse the repository at this point in the history
  • Loading branch information
yufeiminds committed Dec 1, 2023
1 parent 06234bb commit 8b5b07a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/cmd/iac/import/grafana/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func readDashboards(ctx context.Context, opts *importOptions) ([]dashboardtfmod.
}

result = append(result, dashboardtfmod.Manifest{
Name: fmt.Sprint(i),
Name: fmt.Sprintf("dashboard_%d", i),
Title: gjson.GetBytes(content, "title").String(),
Content: content,
})
Expand All @@ -123,7 +123,7 @@ func importDashboardTemplate(ctx context.Context, opts *importOptions) ([]dashbo
if err != nil {
return nil, fmt.Errorf("download template %s failed: %w", opts.TemplateID, err)
}
fmt.Printf("Downloaded Grafana Template %s", opts.TemplateID)
fmt.Println("Downloaded Grafana Template", opts.TemplateID)
defer func() { _ = resp.Body.Close() }()

content, err := io.ReadAll(resp.Body)
Expand All @@ -132,7 +132,7 @@ func importDashboardTemplate(ctx context.Context, opts *importOptions) ([]dashbo
}
return []dashboardtfmod.Manifest{
{
Name: opts.TemplateID,
Name: fmt.Sprintf("template_%s", opts.TemplateID),
Title: gjson.GetBytes(content, "title").String(),
Content: content,
},
Expand Down

0 comments on commit 8b5b07a

Please sign in to comment.