diff --git a/pagerduty/data_source_pagerduty_business_service.go b/pagerduty/data_source_pagerduty_business_service.go index 60278824a..9dc631183 100644 --- a/pagerduty/data_source_pagerduty_business_service.go +++ b/pagerduty/data_source_pagerduty_business_service.go @@ -40,14 +40,10 @@ func dataSourcePagerDutyBusinessServiceRead(d *schema.ResourceData, meta interfa return resource.Retry(5*time.Minute, func() *resource.RetryError { resp, _, err := client.BusinessServices.List() if err != nil { - if isErrCode(err, 429) { - // Delaying retry by 30s as recommended by PagerDuty - // https://developer.pagerduty.com/docs/rest-api-v2/rate-limiting/#what-are-possible-workarounds-to-the-events-api-rate-limit - time.Sleep(30 * time.Second) - return resource.RetryableError(err) - } - - return resource.NonRetryableError(err) + // Delaying retry by 30s as recommended by PagerDuty + // https://developer.pagerduty.com/docs/rest-api-v2/rate-limiting/#what-are-possible-workarounds-to-the-events-api-rate-limit + time.Sleep(30 * time.Second) + return resource.RetryableError(err) } var found *pagerduty.BusinessService diff --git a/pagerduty/data_source_pagerduty_extension_schema.go b/pagerduty/data_source_pagerduty_extension_schema.go index 0f2c7bf24..d0a1d3770 100644 --- a/pagerduty/data_source_pagerduty_extension_schema.go +++ b/pagerduty/data_source_pagerduty_extension_schema.go @@ -41,14 +41,10 @@ func dataSourcePagerDutyExtensionSchemaRead(d *schema.ResourceData, meta interfa return resource.Retry(5*time.Minute, func() *resource.RetryError { resp, _, err := client.ExtensionSchemas.List(&pagerduty.ListExtensionSchemasOptions{Query: searchName}) if err != nil { - if isErrCode(err, 429) { - // Delaying retry by 30s as recommended by PagerDuty - // https://developer.pagerduty.com/docs/rest-api-v2/rate-limiting/#what-are-possible-workarounds-to-the-events-api-rate-limit - time.Sleep(30 * time.Second) - return resource.RetryableError(err) - } - - return resource.NonRetryableError(err) + // Delaying retry by 30s as recommended by PagerDuty + // https://developer.pagerduty.com/docs/rest-api-v2/rate-limiting/#what-are-possible-workarounds-to-the-events-api-rate-limit + time.Sleep(30 * time.Second) + return resource.RetryableError(err) } var found *pagerduty.ExtensionSchema diff --git a/pagerduty/data_source_pagerduty_priority.go b/pagerduty/data_source_pagerduty_priority.go index 054968311..0a863104c 100644 --- a/pagerduty/data_source_pagerduty_priority.go +++ b/pagerduty/data_source_pagerduty_priority.go @@ -42,14 +42,10 @@ func dataSourcePagerDutyPriorityRead(d *schema.ResourceData, meta interface{}) e return resource.Retry(5*time.Minute, func() *resource.RetryError { resp, _, err := client.Priorities.List() if err != nil { - if isErrCode(err, 429) { - // Delaying retry by 30s as recommended by PagerDuty - // https://developer.pagerduty.com/docs/rest-api-v2/rate-limiting/#what-are-possible-workarounds-to-the-events-api-rate-limit - time.Sleep(30 * time.Second) - return resource.RetryableError(err) - } - - return resource.NonRetryableError(err) + // Delaying retry by 30s as recommended by PagerDuty + // https://developer.pagerduty.com/docs/rest-api-v2/rate-limiting/#what-are-possible-workarounds-to-the-events-api-rate-limit + time.Sleep(30 * time.Second) + return resource.RetryableError(err) } var found *pagerduty.Priority diff --git a/pagerduty/data_source_pagerduty_service.go b/pagerduty/data_source_pagerduty_service.go index 21a3531cf..730b65fdf 100644 --- a/pagerduty/data_source_pagerduty_service.go +++ b/pagerduty/data_source_pagerduty_service.go @@ -44,14 +44,10 @@ func dataSourcePagerDutyServiceRead(d *schema.ResourceData, meta interface{}) er return resource.Retry(5*time.Minute, func() *resource.RetryError { resp, _, err := client.Services.List(o) if err != nil { - if isErrCode(err, 429) { - // Delaying retry by 30s as recommended by PagerDuty - // https://developer.pagerduty.com/docs/rest-api-v2/rate-limiting/#what-are-possible-workarounds-to-the-events-api-rate-limit - time.Sleep(30 * time.Second) - return resource.RetryableError(err) - } - - return resource.NonRetryableError(err) + // Delaying retry by 30s as recommended by PagerDuty + // https://developer.pagerduty.com/docs/rest-api-v2/rate-limiting/#what-are-possible-workarounds-to-the-events-api-rate-limit + time.Sleep(30 * time.Second) + return resource.RetryableError(err) } var found *pagerduty.Service diff --git a/pagerduty/data_source_pagerduty_service_integration.go b/pagerduty/data_source_pagerduty_service_integration.go index 7d2adf9a4..0dfccf668 100644 --- a/pagerduty/data_source_pagerduty_service_integration.go +++ b/pagerduty/data_source_pagerduty_service_integration.go @@ -92,10 +92,6 @@ func dataSourcePagerDutyServiceIntegrationRead(d *schema.ResourceData, meta inte } func handleError(err error) *resource.RetryError { - if isErrCode(err, 429) { - time.Sleep(30 * time.Second) - return resource.RetryableError(err) - } - - return resource.NonRetryableError(err) + time.Sleep(30 * time.Second) + return resource.RetryableError(err) } diff --git a/pagerduty/data_source_pagerduty_tag.go b/pagerduty/data_source_pagerduty_tag.go index 4894806c1..c2d913754 100644 --- a/pagerduty/data_source_pagerduty_tag.go +++ b/pagerduty/data_source_pagerduty_tag.go @@ -41,14 +41,10 @@ func dataSourcePagerDutyTagRead(d *schema.ResourceData, meta interface{}) error return resource.Retry(5*time.Minute, func() *resource.RetryError { resp, _, err := client.Tags.List(o) if err != nil { - if isErrCode(err, 429) { - // Delaying retry by 30s as recommended by PagerDuty - // https://developer.pagerduty.com/docs/rest-api-v2/rate-limiting/#what-are-possible-workarounds-to-the-events-api-rate-limit - time.Sleep(30 * time.Second) - return resource.RetryableError(err) - } - - return resource.NonRetryableError(err) + // Delaying retry by 30s as recommended by PagerDuty + // https://developer.pagerduty.com/docs/rest-api-v2/rate-limiting/#what-are-possible-workarounds-to-the-events-api-rate-limit + time.Sleep(30 * time.Second) + return resource.RetryableError(err) } var found *pagerduty.Tag diff --git a/pagerduty/data_source_pagerduty_team.go b/pagerduty/data_source_pagerduty_team.go index 7f2347230..736df6e74 100644 --- a/pagerduty/data_source_pagerduty_team.go +++ b/pagerduty/data_source_pagerduty_team.go @@ -49,14 +49,10 @@ func dataSourcePagerDutyTeamRead(d *schema.ResourceData, meta interface{}) error return resource.Retry(5*time.Minute, func() *resource.RetryError { resp, _, err := client.Teams.List(o) if err != nil { - if isErrCode(err, 429) { - // Delaying retry by 30s as recommended by PagerDuty - // https://developer.pagerduty.com/docs/rest-api-v2/rate-limiting/#what-are-possible-workarounds-to-the-events-api-rate-limit - time.Sleep(30 * time.Second) - return resource.RetryableError(err) - } - - return resource.NonRetryableError(err) + // Delaying retry by 30s as recommended by PagerDuty + // https://developer.pagerduty.com/docs/rest-api-v2/rate-limiting/#what-are-possible-workarounds-to-the-events-api-rate-limit + time.Sleep(30 * time.Second) + return resource.RetryableError(err) } var found *pagerduty.Team