Skip to content

Commit eadb552

Browse files
Make the retries a provider parameter
1 parent 158f097 commit eadb552

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

go.sum

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -571,8 +571,6 @@ 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=
576574
github.com/grafana/grafana-api-golang-client v0.0.0-20211109031802-c957748d66e7 h1:laghHEgZhwoFl6wS67J0t+mSnHrRNpFuovZ2D6PucjI=
577575
github.com/grafana/grafana-api-golang-client v0.0.0-20211109031802-c957748d66e7/go.mod h1:24W29gPe9yl0/3A9X624TPkAOR8DpHno490cPwnkv8E=
578576
github.com/grafana/loki v1.6.1/go.mod h1:X+GvtCzAf2ok/xRLLvGB8kuWP1R+75nXnvjCEnenP0s=

grafana/provider.go

Lines changed: 7 additions & 1 deletion
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,
@@ -172,7 +178,7 @@ func configure(version string, p *schema.Provider) func(context.Context, *schema
172178
cli.Transport = logging.NewTransport("Grafana", transport)
173179
cfg := gapi.Config{
174180
Client: cli,
175-
NumRetries: 10,
181+
NumRetries: d.Get("retries").(int),
176182
OrgID: int64(d.Get("org_id").(int)),
177183
}
178184
if len(auth) == 2 {

0 commit comments

Comments
 (0)