contabo / terraform-provider-contabo

Terraform Provider for Contabo Cloud-Services
MIT License
59 stars 7 forks source link

Unexpected API error, no http response #13

Closed agodard closed 1 year ago

agodard commented 1 year ago

I've been trying this Terraform Provider for several minutes now and couldn't manage to make it work and create a new contabo_instance.

Did I miss something in my config ?

resource "contabo_instance" "my_vps" {
  display_name  = "test"
  product_id    = "V1"
  region        = "EU"
  period        = 1
  image_id      = "3c879b22-5c22-4488-9ffa-6876bc04b580" // opensuse-leap-15.4
  root_password = contabo_secret.root_password.id
  ssh_keys      = [ contabo_secret.ssh_key.id ]
  add_ons {
    id       = "1470" // Docker
    quantity = 1
  }
}

Here is the terraform plan

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # contabo_instance.my_vps will be created
  + resource "contabo_instance" "my_vps" {
      + additional_ips = (known after apply)
      + cpu_cores      = (known after apply)
      + created_date   = (known after apply)
      + disk_mb        = (known after apply)
      + display_name   = "test"
      + error_message  = (known after apply)
      + id             = (known after apply)
      + image_id       = "3c879b22-5c22-4488-9ffa-6876bc04b580"
      + ip_config      = (known after apply)
      + last_updated   = (known after apply)
      + license        = (known after apply)
      + mac_address    = (known after apply)
      + name           = (known after apply)
      + os_type        = (known after apply)
      + period         = 1
      + product_id     = "V1"
      + product_type   = (known after apply)
      + ram_mb         = (known after apply)
      + region         = "EU"
      + root_password  = 60525
      + ssh_keys       = [
          + 60525,
        ]
      + status         = (known after apply)
      + v_host_id      = (known after apply)

      + add_ons {
          + id       = "1470"
          + quantity = 1
        }
    }

And I keep receiving "Unexpected API error, no http response" after 20 minutes of ellapsed time :

contabo_instance.my_vps: Still creating... [20m0s elapsed]
╷
│ Error: Unexpected API error, no http response
│ 
│   with contabo_instance.my_vps,
│   on main.tf line 44, in resource "contabo_instance" "my_vps":
│   44: resource "contabo_instance" "my_vps" {
│ 
│ Unexpected API error, no http response

FYI my account Balance is credited of €14.38 each time I to use the API but nothing appear in "Your Services" panel.

Last but not least, I would like to edit and configure my manually-bought VPS instances from Terraform but I can't achieve that yet since all "contabo_instance" resources I create provide a new infrastructure and I can't edit a "contabo_instance" data. Am I obliged to configure them manually without Terraform then ?

ngotzmann commented 1 year ago

Are you using the latest version and did you configured your Contabo API credentials as described in the provider documentation? If you have done this and it is still not working, please reach out to us via our support and provide us your Customer Id. Also please write in the support ticket, that you have an issue with terraform and that you need an developer. Then the ticket will reach us faster!

agodard commented 1 year ago

Thank you for your quick answer ! I am using the last provider version (v0.1.16) and the API credentials are configured properly.

The instances finally appear in my account. It seems the API is just very long to provision the resources.

Is there a way to edit my manually-bought VPS instances with Terraform without creating new resources ? The documenation isn't clear about it. I have tried using data "contabo_instance" with no success.

EDIT: It is definitely possible, I found the answer here : https://github.com/contabo/terraform-provider-contabo/issues/7