StatusCakeDev / terraform-provider-statuscake

Terraform StatusCake provider
https://registry.terraform.io/providers/StatusCakeDev/statuscake/
Mozilla Public License 2.0
35 stars 55 forks source link

Intermittent/Non-Actionable Error in statuscake_uptime_check resource #195

Open fishfacemcgee opened 4 days ago

fishfacemcgee commented 4 days ago

Describe the bug When attempting to run terraform plan in a workspace that manages some statuscake_uptime_check resources, we will intermittently get failures that cause the plan to hard error. However, there's no information in the error to suggest a cause, let alone a solution.

Error: failed to get uptime check with ID: undefined response type: failed to deserialise error response

To Reproduce

This is an intermittent error so I don't expect reproduction to be easy/likely. Best guess would be an intermittent outage in the Statuscake API itself and/or an unclear rate limit. The workspace manages 5 uptime checks.

Expected behaviour

Either no error, or an error that actually tells us what's wrong.

Screenshots

Screenshot 2024-10-23 at 2 08 41 PM

Additional context

These plans run in an HCP Terraform environment, so getting any additional diagnostic information may be difficult, if not impossible.

fishfacemcgee commented 4 days ago

Looking at Statuscake's API docs, it appears especially likely that ratelimiting is the issue, in which case the problem is the Provider is not handling that properly.

fishfacemcgee commented 4 days ago

As far as the errors being unable to be deserialized, it looks like https://github.com/StatusCakeDev/statuscake-go/issues/37 may be related.

fishfacemcgee commented 4 days ago

Poking around the docs more, I see that the rate limit side of this is a misconfiguration on my end. I wouldn't have expected to need to configure retry logic on the provider settings, but it's at least something the provider allows for, even if it's not automatic. That leaves the remaining issue that the provider is displaying non-actionable errors and/or the API is providing response data in a way the Go SDK cannot handle properly (and therefore can't pass along actionable information to the provider to give to us).

Can confirm that adding

  retries     = 2
  min_backoff = 5
  max_backoff = 10

to my statuscake provider block resolves the errors I was receiving, confirming they were rate limit based.