civo/terraform-provider-civo

Delete Firewall fails with 500: an error occurred while tring to delete the firewall

guineveresaenger opened this issue · 3 comments

When I try to delete a Kubernetes cluster and a firewall using destroy, I get the following error:

* [ERR] an error occurred while tring to delete the firewall xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx, Error: Unknown error response - status: 500 Internal Server Error, code: 500, reason: {"code":"database_firewall_deleted_failed","result":"failed","reason":"Failed to delete that firewall from the internal database"}

I can verify in the dashboard that my firewall indeed still exists.

Using curl and the firewall ID from the response, I can successfully delete:

curl -H "Authorization: bearer xxxx" -X DELETE https://api.civo.com/v2/firewalls/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx
{"result":"success"}

Steps to reproduce:

  1. Create a Civo Kubernetes cluster and firewall:
    main.tf
terraform {
  required_providers {
    civo = {
      source = "civo/civo"
      version = "1.0.18"
    }
  }
}

provider "civo" {
  # Configuration options
    token = "XXX"
    region = "NYC1"
}

# Create a firewall
resource "civo_firewall" "guin-firewall" {
    name = "guin-tf-fw"
}
# Create a cluster
resource "civo_kubernetes_cluster" "guin-cluster" {
    name = "guin-tf-cluster"
    firewall_id = civo_firewall.guin-firewall.id
    pools {
        label = "front-end" // Optional
        size = "g4s.kube.xsmall"
        node_count = 3
    }
}

$terraform apply

  1. Attempt to destroy the resources:

$terraform destroy

  1. Output:
civo_kubernetes_cluster.guin-cluster: Destroying... [id=xxx]
civo_kubernetes_cluster.guin-cluster: Destruction complete after 2s
civo_firewall.guin-firewall: Destroying... [id=xxx]
╷
│ Error: [ERR] an error occurred while tring to delete the firewall xxx, Error: Unknown error response - status: 500 Internal Server Error, code: 500, reason: {"code":"database_firewall_deleted_failed","result":"failed","reason":"Failed to delete that firewall from the internal database"}
│ 
│ 
│ 
╵

UPDATE: It appears sometimes curl also fails to delete the firewall, so something is broken with the Civo service. Will file an issue there.

@guin:~🦉 curl -H "Authorization: bearer xxx" -X DELETE https://api.civo.com/v2/firewalls/xxx
{"code":"database_firewall_deleted_failed","result":"failed","reason":"Failed to delete that firewall from the internal database"}

Any update on when this will be resolved?

hello, @guineveresaenger did you have a chance to check if the problem is solved? The issue is relatively old and the Civo API have been updated since.
Thanks for contributing!

This issue is fixed now