Skip to content

Commit e41a342

Browse files
add message to dashboard creation (#306)
* add message to dashboard creation * fix tab spacing * Update client library and generate docs * Ignore message in import test Co-authored-by: Justin Mai <[email protected]> Co-authored-by: Julien Duchesne <[email protected]>
1 parent 2d01d80 commit e41a342

File tree

6 files changed

+15
-6
lines changed

6 files changed

+15
-6
lines changed

docs/resources/dashboard.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ resource "grafana_dashboard" "metrics" {
3333

3434
- **folder** (Number) The id of the folder to save the dashboard in.
3535
- **id** (String) The ID of this resource.
36+
- **message** (String) Set a commit message for the version history.
3637
- **overwrite** (Boolean) Set to true if you want to overwrite existing dashboard with newer version, same dashboard title in folder or same dashboard uid.
3738

3839
### Read-Only

examples/resources/grafana_dashboard/_acc_basic.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ resource "grafana_dashboard" "test" {
1111
"version": 34
1212
}
1313
EOD
14+
message = "inital commit."
1415
}

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/grafana/terraform-provider-grafana
33
go 1.16
44

55
require (
6-
github.com/grafana/grafana-api-golang-client v0.1.0
6+
github.com/grafana/grafana-api-golang-client v0.1.1
77
github.com/grafana/synthetic-monitoring-agent v0.3.3
88
github.com/grafana/synthetic-monitoring-api-go-client v0.3.0
99
github.com/hashicorp/go-cleanhttp v0.5.2

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -452,8 +452,8 @@ github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51
452452
github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
453453
github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
454454
github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
455-
github.com/grafana/grafana-api-golang-client v0.1.0 h1:z2PL/r+HjnaXEakVT9n5v/43vVYvl0rXty/KpGmAsoE=
456-
github.com/grafana/grafana-api-golang-client v0.1.0/go.mod h1:24W29gPe9yl0/3A9X624TPkAOR8DpHno490cPwnkv8E=
455+
github.com/grafana/grafana-api-golang-client v0.1.1 h1:qS/i3dxITGyDRqYuBLk679SjpSwPQ3VZyxuTsKq1Bas=
456+
github.com/grafana/grafana-api-golang-client v0.1.1/go.mod h1:24W29gPe9yl0/3A9X624TPkAOR8DpHno490cPwnkv8E=
457457
github.com/grafana/synthetic-monitoring-agent v0.3.0/go.mod h1:P8WTBnw3SIZW5Nm5obOlSKvD887IxAfbrJkSnoZyIlA=
458458
github.com/grafana/synthetic-monitoring-agent v0.3.3 h1:/MM1vm/BwnbwQ2/aEwKbEpf01O4O3GhrcOofY4A0V9Q=
459459
github.com/grafana/synthetic-monitoring-agent v0.3.3/go.mod h1:qyo27gOTdj8K/dKkd+/SJ0M0zlnCV7t9nwVK+iLkVrk=

grafana/resource_dashboard.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ Manages Grafana dashboards.
7474
Optional: true,
7575
Description: "Set to true if you want to overwrite existing dashboard with newer version, same dashboard title in folder or same dashboard uid.",
7676
},
77+
"message": {
78+
Type: schema.TypeString,
79+
Optional: true,
80+
Description: "Set a commit message for the version history.",
81+
},
7782
},
7883
SchemaVersion: 1,
7984
StateUpgraders: []schema.StateUpgrader{
@@ -255,6 +260,7 @@ func makeDashboard(d *schema.ResourceData) gapi.Dashboard {
255260
dashboard := gapi.Dashboard{
256261
Folder: int64(d.Get("folder").(int)),
257262
Overwrite: d.Get("overwrite").(bool),
263+
Message: d.Get("message").(string),
258264
}
259265
configJSON := d.Get("config_json").(string)
260266
dashboardJSON, err := unmarshalDashboardConfigJSON(configJSON)

grafana/resource_dashboard_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,10 @@ func TestAccDashboard_basic(t *testing.T) {
6262
},
6363
{
6464
// Importing matches the state of the previous step.
65-
ResourceName: "grafana_dashboard.test",
66-
ImportState: true,
67-
ImportStateVerify: true,
65+
ResourceName: "grafana_dashboard.test",
66+
ImportState: true,
67+
ImportStateVerify: true,
68+
ImportStateVerifyIgnore: []string{"message"},
6869
},
6970
},
7071
})

0 commit comments

Comments
 (0)