Skip to content

Commit abfc740

Browse files
authored
make sm_url configurable (#242)
1 parent 8444465 commit abfc740

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

grafana/provider.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@ func Provider(version string) func() *schema.Provider {
8383
DefaultFunc: schema.EnvDefaultFunc("GRAFANA_SM_ACCESS_TOKEN", nil),
8484
Description: "A Synthetic Monitoring access token. May alternatively be set via the `GRAFANA_SM_ACCESS_TOKEN` environment variable.",
8585
},
86+
"sm_url": {
87+
Type: schema.TypeString,
88+
Optional: true,
89+
DefaultFunc: schema.EnvDefaultFunc("GRAFANA_SM_URL", "https://synthetic-monitoring-api.grafana.net"),
90+
Description: "Synthetic monitoring backend address. May alternatively be set via the `GRAFANA_SM_URL` environment variable.",
91+
},
8692
},
8793

8894
ResourcesMap: map[string]*schema.Resource{
@@ -182,7 +188,8 @@ func configure(version string, p *schema.Provider) func(context.Context, *schema
182188
c.gapi = gclient
183189

184190
smToken := d.Get("sm_access_token").(string)
185-
c.smapi = smapi.NewClient("https://synthetic-monitoring-api.grafana.net", smToken, nil)
191+
smUrl := d.Get("sm_url").(string)
192+
c.smapi = smapi.NewClient(smUrl, smToken, nil)
186193

187194
return c, diags
188195
}

0 commit comments

Comments
 (0)