Skip to content

Commit df09871

Browse files
Merge pull request #284 from flokli/retry
grafana/provider.go: set NumRetries
2 parents eb9f473 + eadb552 commit df09871

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

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.0.0-20211005011003-c69abe946fa6
6+
github.com/grafana/grafana-api-golang-client v0.0.0-20211109031802-c957748d66e7
77
github.com/grafana/synthetic-monitoring-agent v0.0.24
88
github.com/grafana/synthetic-monitoring-api-go-client v0.0.2
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
@@ -571,8 +571,8 @@ github.com/gorilla/mux v1.7.1/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2z
571571
github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
572572
github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
573573
github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
574-
github.com/grafana/grafana-api-golang-client v0.0.0-20211005011003-c69abe946fa6 h1:B8YsmxR/o6nAJRPofr47bckY+MNGPj6Ejs8iAY4gXkI=
575-
github.com/grafana/grafana-api-golang-client v0.0.0-20211005011003-c69abe946fa6/go.mod h1:24W29gPe9yl0/3A9X624TPkAOR8DpHno490cPwnkv8E=
574+
github.com/grafana/grafana-api-golang-client v0.0.0-20211109031802-c957748d66e7 h1:laghHEgZhwoFl6wS67J0t+mSnHrRNpFuovZ2D6PucjI=
575+
github.com/grafana/grafana-api-golang-client v0.0.0-20211109031802-c957748d66e7/go.mod h1:24W29gPe9yl0/3A9X624TPkAOR8DpHno490cPwnkv8E=
576576
github.com/grafana/loki v1.6.1/go.mod h1:X+GvtCzAf2ok/xRLLvGB8kuWP1R+75nXnvjCEnenP0s=
577577
github.com/grafana/synthetic-monitoring-agent v0.0.23/go.mod h1:luWgdBaAQgOz9e6m/cGQCFFrPWkBTl+VZM/UC+75nSM=
578578
github.com/grafana/synthetic-monitoring-agent v0.0.24 h1:qfDFWIW2iPmffAsLO9WG/h8inAV+D/nXbQUQ4DTdL3E=

grafana/provider.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ func Provider(version string) func() *schema.Provider {
4646
DefaultFunc: schema.EnvDefaultFunc("GRAFANA_AUTH", nil),
4747
Description: "API token or basic auth username:password. May alternatively be set via the `GRAFANA_AUTH` environment variable.",
4848
},
49+
"retries": {
50+
Type: schema.TypeInt,
51+
Optional: true,
52+
DefaultFunc: schema.EnvDefaultFunc("GRAFANA_RETRIES", 3),
53+
Description: "The amount of retries to use for Grafana API calls. May alternatively be set via the `GRAFANA_RETRIES` environment variable.",
54+
},
4955
"org_id": {
5056
Type: schema.TypeInt,
5157
Required: true,
@@ -171,8 +177,9 @@ func configure(version string, p *schema.Provider) func(context.Context, *schema
171177

172178
cli.Transport = logging.NewTransport("Grafana", transport)
173179
cfg := gapi.Config{
174-
Client: cli,
175-
OrgID: int64(d.Get("org_id").(int)),
180+
Client: cli,
181+
NumRetries: d.Get("retries").(int),
182+
OrgID: int64(d.Get("org_id").(int)),
176183
}
177184
if len(auth) == 2 {
178185
cfg.BasicAuth = url.UserPassword(auth[0], auth[1])

0 commit comments

Comments
 (0)