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

[Bug]: Plugin crash while destroying infrastructure

Open pitastrudl opened this issue 2 years ago • 0 comments

Using terraform v1.1.9 and v1.33.2 hcloud provider

What happened?

simple terraform destroy action.

hcloud_server_network.main_network[1]: Destruction complete after 9s
hcloud_server_network.main_network[2]: Still destroying... [id=20587124-1661743, 10s elapsed]
╷
│ Error: Plugin did not respond
│ 
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs may contain more details.
╵

Stack trace from the terraform-provider-hcloud_v1.33.2 plugin:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xa9ee37]

goroutine 285 [running]:
github.com/hetznercloud/hcloud-go/hcloud.(*ActionClient).WatchOverallProgress.func1()
        github.com/hetznercloud/[email protected]/hcloud/action.go:196 +0x1b7
created by github.com/hetznercloud/hcloud-go/hcloud.(*ActionClient).WatchOverallProgress
        github.com/hetznercloud/[email protected]/hcloud/action.go:189 +0x12e

Error: The terraform-provider-hcloud_v1.33.2 plugin crashed!

This is always indicative of a bug within the plugin. It would be immensely
helpful if you could report the crash with the plugin's maintainers so that it
can be fixed. The output above should help diagnose the issue.

It also happened while creating that the server locks up for some reason:

hcloud_server_network.main_network[0]: Creation complete after 9s [id=20591725-1662142]
hcloud_server_network.main_network[2]: Still creating... [10s elapsed]
╷
│ Error: attach server to network: cannot perform operation because server is locked (locked)
│ 
│   with hcloud_server_network.main_network[2],
│   on network.tf line 18, in resource "hcloud_server_network" "main_network":
│   18: resource "hcloud_server_network" "main_network" {
│ 
╵

What did you expect to happen?

Destroy the infra

Please provide a minimal working example

resource "hcloud_network" "priv" {
  name     = "priv"
  ip_range = var.ip_range
}

resource "hcloud_server_network" "main_network" {
  count     = var.core_count + var.node_count
  server_id = element(concat(hcloud_server.core.*.id, hcloud_server.node.*.id), count.index)
  subnet_id = hcloud_network_subnet.priv_subnet.id
}

resource "hcloud_network_subnet" "priv_subnet" {
  network_id   = hcloud_network.priv.id
  type         = "cloud"
  network_zone = "eu-central"
  ip_range     = var.cloud_subnet
}

pitastrudl avatar May 19 '22 09:05 pitastrudl