@@ -397,12 +397,13 @@ func createGrafanaClient(d *schema.ResourceData) (string, *gapi.Config, *gapi.Cl
397397 }
398398
399399 cfg := gapi.Config {
400- Client : cli ,
401- NumRetries : d .Get ("retries" ).(int ),
402- RetryTimeout : time .Second * time .Duration (d .Get ("retry_wait" ).(int )),
403- BasicAuth : userInfo ,
404- OrgID : orgID ,
405- APIKey : apiKey ,
400+ Client : cli ,
401+ NumRetries : d .Get ("retries" ).(int ),
402+ RetryTimeout : time .Second * time .Duration (d .Get ("retry_wait" ).(int )),
403+ RetryStatusCodes : []string {"429" , "5xx" , "401" }, // In high load scenarios, Grafana sometimes returns 401s (unable to authenticate the user?)
404+ BasicAuth : userInfo ,
405+ OrgID : orgID ,
406+ APIKey : apiKey ,
406407 }
407408
408409 if v , ok := d .GetOk ("retry_status_codes" ); ok {
@@ -441,15 +442,16 @@ func createGrafanaOAPIClient(apiURL string, d *schema.ResourceData) (*goapi.Graf
441442 }
442443
443444 cfg := goapi.TransportConfig {
444- Host : u .Host ,
445- BasePath : apiPath ,
446- Schemes : []string {u .Scheme },
447- NumRetries : d .Get ("retries" ).(int ),
448- RetryTimeout : time .Second * time .Duration (d .Get ("retry_wait" ).(int )),
449- TLSConfig : tlsClientConfig ,
450- BasicAuth : userInfo ,
451- OrgID : orgID ,
452- APIKey : APIKey ,
445+ Host : u .Host ,
446+ BasePath : apiPath ,
447+ Schemes : []string {u .Scheme },
448+ NumRetries : d .Get ("retries" ).(int ),
449+ RetryTimeout : time .Second * time .Duration (d .Get ("retry_wait" ).(int )),
450+ RetryStatusCodes : []string {"429" , "5xx" , "401" }, // In high load scenarios, Grafana sometimes returns 401s (unable to authenticate the user?)
451+ TLSConfig : tlsClientConfig ,
452+ BasicAuth : userInfo ,
453+ OrgID : orgID ,
454+ APIKey : APIKey ,
453455 }
454456
455457 if v , ok := d .GetOk ("retry_status_codes" ); ok {
0 commit comments