terraform-provider-digitalocean icon indicating copy to clipboard operation
terraform-provider-digitalocean copied to clipboard

Handle service errors and retry when creating a Database Connection Pool fails

Open magsoftware opened this issue 4 years ago • 2 comments

Terraform Version

Terraform v0.12.25

Affected Resource(s)

Please list the resources as a list, for example:

  • digitalocean_database_connection_pool

Terraform Configuration Files

same as issue 445

Debug Output

digitalocean_kubernetes_cluster.flexvoucher: Still creating... [6m50s elapsed]
digitalocean_kubernetes_cluster.flexvoucher: Still creating... [7m0s elapsed]
digitalocean_kubernetes_cluster.flexvoucher: Creation complete after 7m2s [id=f77426a4-a737-4a7f-8518-47ff3e25e9c7]
digitalocean_database_firewall.flexvoucher: Creating...
digitalocean_database_firewall.flexvoucher: Creation complete after 3s [id=13f9e963-ef58-43e9-8246-7ffc87ff2034-20200601083814701500000002]

Error: Error creating DatabaseConnectionPool: POST https://api.digitalocean.com/v2/databases/13f9e963-ef58-43e9-8246-7ffc87ff2034/pools: 500 Server Error

  on rdb.tf line 38, in resource "digitalocean_database_connection_pool" "flexvoucher":
  38: resource "digitalocean_database_connection_pool" "flexvoucher" {

Expected Behavior

Connection pool should be created.

Actual Behavior

Server error 500 on connection pool creation.

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply

Important Factoids

This error does not occur always.

magsoftware avatar Jun 01 '20 10:06 magsoftware

I'm also seeing this 6 months later! 👎🏻

Terraform v0.14.3
Initializing plugins and modules...
digitalocean_database_connection_pool.pool-01: Creating...

Error creating DatabaseConnectionPool: POST https://api.digitalocean.com/v2/databases/69966f63-6fe5-45a7-a706-9939dfc04686/pools: 500 Server Error

lenardchristopher avatar Dec 22 '20 23:12 lenardchristopher

It looks like there's an opportunity to add some retry logic to handle service errors.

However, there will be cases when there's an issue with the service and a retry won't resolve the terraform error. For those cases, the best course of action would be to contact support to report the service issue. It's best to have a request_id for the POST request. This can be retrieved by setting the environment variable TF_LOG=debug when calling terraform apply. This is a very verbose output but will include the response header X-Request-Id which can be supplied when contacting support.

I've updated the issue templates for this repo to include instructions about contacting support for service issues (#633) also.

I'll leave this issue open but will rename it to add the retry logic.

scotchneat avatar May 14 '21 15:05 scotchneat