File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed
Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import (
1010
1111 "github.com/PagerDuty/terraform-provider-pagerduty/util"
1212 "github.com/hashicorp/terraform-plugin-sdk/v2/helper/logging"
13+ "github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry"
1314 "github.com/heimweh/go-pagerduty/pagerduty"
1415 "github.com/heimweh/go-pagerduty/persistentconfig"
1516)
@@ -112,9 +113,20 @@ func (c *Config) Client() (*pagerduty.Client, error) {
112113 }
113114
114115 if ! c .SkipCredsValidation {
115- // Validate the credentials by calling the abilities endpoint,
116- // if we get a 401 response back we return an error to the user
117- if err := client .ValidateAuth (); err != nil {
116+ err := retry .Retry (2 * time .Minute , func () * retry.RetryError {
117+ if err := client .ValidateAuth (); err != nil {
118+ return retry .NonRetryableError (err )
119+ }
120+
121+ // Validate the credentials by calling the abilities endpoint,
122+ // if we get a 401 response back we return an error to the user
123+ if err := client .ValidateAuth (); err != nil {
124+ return retry .RetryableError (err )
125+ }
126+ return nil
127+ })
128+
129+ if err != nil {
118130 return nil , fmt .Errorf (fmt .Sprintf ("%s\n %s" , err , invalidCreds ))
119131 }
120132 }
You can’t perform that action at this time.
0 commit comments