Skip to content

Commit

Permalink
Silence org_id deprecation warning when not using it (#984)
Browse files Browse the repository at this point in the history
The default value is making Terraform complain even if `org_id` isn't specified
  • Loading branch information
julienduchesne authored Jul 14, 2023
1 parent b1eafa3 commit 5fd293e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions internal/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ func Provider(version string) func() *schema.Provider {
Type: schema.TypeInt,
Optional: true,
Deprecated: "Use the `org_id` attributes on resources instead.",
DefaultFunc: schema.EnvDefaultFunc("GRAFANA_ORG_ID", 1),
DefaultFunc: schema.EnvDefaultFunc("GRAFANA_ORG_ID", nil),
Description: "Deprecated: Use the `org_id` attributes on resources instead.",
},
"tls_key": {
Expand Down Expand Up @@ -410,7 +410,10 @@ func createGrafanaClient(d *schema.ResourceData) (string, *gapi.Config, *gapi.Cl
if v, ok := d.GetOk("retry_status_codes"); ok {
cfg.RetryStatusCodes = common.SetToStringSlice(v.(*schema.Set))
}
orgID := d.Get("org_id").(int)
orgID := 1
if v, ok := d.GetOk("org_id"); ok {
orgID = v.(int)
}
if len(auth) == 2 {
cfg.BasicAuth = url.UserPassword(auth[0], auth[1])
cfg.OrgID = int64(orgID)
Expand Down

0 comments on commit 5fd293e

Please sign in to comment.