Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VM doesn't shut down when trying to destroy #1255

Closed
MichalMarchewka opened this issue May 3, 2024 · 10 comments
Closed

VM doesn't shut down when trying to destroy #1255

MichalMarchewka opened this issue May 3, 2024 · 10 comments
Labels
🐛 bug Something isn't working ⌛ pending author's response Requested additional information from the reporter

Comments

@MichalMarchewka
Copy link

MichalMarchewka commented May 3, 2024

Describe the bug
Virtual Machine isn't deleted because it doesn't shut down

To Reproduce

  1. Create a resource
resource "proxmox_virtual_environment_vm" "test_01" {
  name        = "test-01"
  description = "Managed by Terraform"
  tags        = ["test"]
  on_boot     = true
  node_name = "pve"

  #agent {
  #  enabled = true
  #}

  operating_system {
    type = "l26"
  }

  cpu {
    cores = 2
    type  = "host"
    numa  = true
  }

  memory {
    dedicated = 1024
  }

  disk {
    size         = "30"
    interface    = "virtio0"
    datastore_id = "local-lvm"
    file_format  = "raw"
  }

  network_device {
    bridge = "vmbr0"
    model  = "virtio"
  }

  initialization {
    # interface = "scsi1"
    ip_config {
      ipv4 {
        address = "dhcp"
      }
    }
  }
}
  1. Run 'terraform apply --auto-approve"
  2. Wait for VM to be created
  3. Remove the VM configuration from Terraform
  4. Run 'terraform apply --auto-approve"
  5. Notice behaviour:
  • Terraform - "still destroying"
  • Virtual Machine (Proxmox console) - "VM 100 - Shutdown"

Please also provide a minimal Terraform configuration that reproduces the issue.

# 2024-05-03T03:13:06.793+0200 [INFO]  backend/local: apply calling Apply
2024-05-03T03:13:06.793+0200 [DEBUG] Building and walking apply graph for NormalMode plan
2024-05-03T03:13:06.794+0200 [DEBUG] ProviderTransformer: "proxmox_virtual_environment_vm.test_01 (destroy)" (*terraform.NodeDestroyResourceInstance) needs provider["registry.terraform.io/bpg/proxmox"]
2024-05-03T03:13:06.794+0200 [DEBUG] ReferenceTransformer: "provider[\"registry.terraform.io/bpg/proxmox\"]" references: []
2024-05-03T03:13:06.794+0200 [DEBUG] Starting graph walk: walkApply
2024-05-03T03:13:06.794+0200 [DEBUG] created provider logger: level=debug
2024-05-03T03:13:06.794+0200 [INFO]  provider: configuring client automatic mTLS
2024-05-03T03:13:06.799+0200 [DEBUG] provider: starting plugin: path=.terraform/providers/registry.terraform.io/bpg/proxmox/0.55.0/windows_amd64/terraform-provider-proxmox_v0.55.0.exe args=[".terraform/providers/registry.terraform.io/bpg/proxmox/0.55.0/windows_amd64/terraform-provider-proxmox_v0.55.0.exe"]
2024-05-03T03:13:06.801+0200 [DEBUG] provider: plugin started: path=.terraform/providers/registry.terraform.io/bpg/proxmox/0.55.0/windows_amd64/terraform-provider-proxmox_v0.55.0.exe pid=9336
2024-05-03T03:13:06.801+0200 [DEBUG] provider: waiting for RPC address: path=.terraform/providers/registry.terraform.io/bpg/proxmox/0.55.0/windows_amd64/terraform-provider-proxmox_v0.55.0.exe
2024-05-03T03:13:06.810+0200 [INFO]  provider.terraform-provider-proxmox_v0.55.0.exe: configuring server automatic mTLS: timestamp="2024-05-03T03:13:06.809+0200"
2024-05-03T03:13:06.820+0200 [DEBUG] provider.terraform-provider-proxmox_v0.55.0.exe: plugin address: address=127.0.0.1:10001 network=tcp timestamp="2024-05-03T03:13:06.820+0200"
2024-05-03T03:13:06.820+0200 [DEBUG] provider: using plugin: version=6
2024-05-03T03:13:06.830+0200 [INFO]  provider.terraform-provider-proxmox_v0.55.0.exe: Configuring the Proxmox provider...: tf_mux_provider="*proto6server.Server" tf_req_id=d1d45ca0-5128-0fd8-1234-45007ff9a47e @caller=github.com/bpg/terraform-provider-proxmox/fwprovider/provider.go:233 @module=proxmox tf_provider_addr=registry.terraform.io/bpg/proxmox tf_rpc=ConfigureProvider timestamp="2024-05-03T03:13:06.830+0200"
proxmox_virtual_environment_vm.test_01: Destroying... [id=100]
2024-05-03T03:13:06.834+0200 [INFO]  Starting apply for proxmox_virtual_environment_vm.test_01
2024-05-03T03:13:06.834+0200 [DEBUG] proxmox_virtual_environment_vm.test_01: applying the planned Delete change
2024-05-03T03:13:06.837+0200 [DEBUG] provider.terraform-provider-proxmox_v0.55.0.exe: Sending HTTP Request: tf_http_trans_id=d5abdd65-cebc-fa40-63be-6d181a3a3514 tf_provider_addr=registry.terraform.io/bpg/proxmox tf_resource_type=proxmox_virtual_environment_vm @module=proxmox Accept=application/json tf_http_op_type=request @caller=github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/logging/logging_http_transport.go:162 tf_http_req_body="" tf_http_req_method=GET tf_http_req_version=HTTP/1.1 tf_mux_provider=tf5to6server.v5tov6Server tf_req_id=9e3b2a5b-4ed4-bf35-99f2-490028855609 Accept-Encoding=gzip User-Agent=Go-http-client/1.1 tf_http_req_uri=/api2/json/nodes/pve/qemu/100/status/current tf_rpc=ApplyResourceChange Authorization="PVEAPIToken=terraform@pve!provider=REDACTED" Host=192.168.90.216:8006 timestamp="2024-05-03T03:13:06.837+0200"
2024-05-03T03:13:06.860+0200 [DEBUG] provider.terraform-provider-proxmox_v0.55.0.exe: Received HTTP Response: tf_http_op_type=response tf_http_res_status_reason="200 OK" Connection=[Keep-Alive, Keep-Alive] Expires="Fri, 03 May 2024 01:13:07 GMT" tf_http_res_status_code=200 tf_http_res_version=HTTP/1.1 tf_provider_addr=registry.terraform.io/bpg/proxmox tf_req_id=9e3b2a5b-4ed4-bf35-99f2-490028855609 @caller=github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/logging/logging_http_transport.go:162 tf_http_res_body="{\"data\":{\"nics\":{\"tap100i0\":{\"netout\":91980,\"netin\":299029}},\"running-machine\":\"pc-i440fx-8.1+pve0\",\"cpus\":2,\"vmid\":100,\"proxmox-support\":{\"query-bitmap-info\":true,\"pbs-masterkey\":true,\"pbs-library-version\":\"1.4.1 (UNKNOWN)\",\"backup-fleecing\":true,\"pbs-dirty-bitmap-migration\":true,\"pbs-dirty-bitmap-savevm\":true,\"pbs-dirty-bitmap\":true,\"backup-max-workers\":true},\"tags\":\"test\",\"clipboard\":null,\"cpu\":0.182601570754428,\"status\":\"running\",\"uptime\":915,\"maxmem\":1073741824,\"pid\":5251,\"diskread\":181248,\"ha\":{\"managed\":0},\"mem\":27388279,\"qmpstatus\":\"running\",\"disk\":0,\"name\":\"test-01\",\"running-qemu\":\"8.1.5\",\"netin\":299029,\"maxdisk\":32212254720,\"diskwrite\":0,\"blockstat\":{\"ide2\":{\"account_invalid\":true,\"invalid_unmap_operations\":0,\"failed_zone_append_operations\":0,\"failed_rd_operations\":0,\"invalid_rd_operations\":0,\"wr_merged\":0,\"unmap_bytes\":0,\"wr_operations\":0,\"rd_total_time_ns\":6124170,\"wr_highest_offset\":0,\"account_failed\":true,\"wr_bytes\":0,\"failed_wr_operations\":0,\"invalid_wr_operations\":0,\"unmap_merged\":0,\"invalid_flush_operations\":0,\"failed_unmap_operations\":0,\"unmap_total_time_ns\":0,\"timed_stats\":[],\"rd_operations\":71,\"flush_operations\":0,\"zone_append_merged\":0,\"rd_merged\":0,\"flush_total_time_ns\":0,\"unmap_operations\":0,\"failed_flush_operations\":0,\"idle_time_ns\":499968608,\"zone_append_operations\":0,\"zone_append_total_time_ns\":0,\"rd_bytes\":145408,\"zone_append_bytes\":0,\"invalid_zone_append_operations\":0,\"wr_total_time_ns\":0},\"virtio0\":{\"rd_total_time_ns\":11122844,\"wr_highest_offset\":0,\"invalid_wr_operations\":0,\"unmap_merged\":0,\"wr_bytes\":0,\"account_failed\":true,\"failed_wr_operations\":0,\"failed_rd_operations\":0,\"failed_zone_append_operations\":0,\"invalid_rd_operations\":0,\"account_invalid\":true,\"invalid_unmap_operations\":0,\"unmap_bytes\":0,\"wr_operations\":0,\"wr_merged\":0,\"rd_bytes\":35840,\"zone_append_bytes\":0,\"wr_total_time_ns\":0,\"invalid_zone_append_operations\":0,\"rd_merged\":0,\"invalid_flush_operations\":0,\"unmap_total_time_ns\":0,\"failed_unmap_operations\":0,\"rd_operations\":70,\"timed_stats\":[],\"zone_append_merged\":0,\"flush_operations\":0,\"failed_flush_operations\":0,\"idle_time_ns\":10861540863,\"zone_append_operations\":0,\"zone_append_total_time_ns\":0,\"flush_total_time_ns\":0,\"unmap_operations\":0}},\"netout\":91980}}" Cache-Control=max-age=0 Content-Type=application/json;charset=UTF-8 Pragma=no-cache tf_http_trans_id=d5abdd65-cebc-fa40-63be-6d181a3a3514 tf_rpc=ApplyResourceChange @module=proxmox Date="Fri, 03 May 2024 01:13:07 GMT" Server=pve-api-daemon/3.0 tf_mux_provider=tf5to6server.v5tov6Server tf_resource_type=proxmox_virtual_environment_vm timestamp="2024-05-03T03:13:06.860+0200"
2024-05-03T03:13:06.861+0200 [DEBUG] provider.terraform-provider-proxmox_v0.55.0.exe: Shutting down VM: tf_provider_addr=registry.terraform.io/bpg/proxmox tf_rpc=ApplyResourceChange @module=proxmox tf_mux_provider=tf5to6server.v5tov6Server @caller=github.com/bpg/terraform-provider-proxmox/proxmoxtf/resource/vm/vm.go:1686 tf_req_id=9e3b2a5b-4ed4-bf35-99f2-490028855609 tf_resource_type=proxmox_virtual_environment_vm timestamp="2024-05-03T03:13:06.860+0200"
2024-05-03T03:13:06.862+0200 [DEBUG] provider.terraform-provider-proxmox_v0.55.0.exe: Sending HTTP Request: Content-Type=application/x-www-form-urlencoded tf_http_trans_id=974223b6-e237-5aaf-4235-81d57dbbb85d tf_provider_addr=registry.terraform.io/bpg/proxmox tf_rpc=ApplyResourceChange Accept=application/json Accept-Encoding=gzip Authorization="PVEAPIToken=terraform@pve!provider=REDACTED" Content-Length=24 tf_http_op_type=request tf_http_req_method=POST tf_http_req_version=HTTP/1.1 @caller=github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/logging/logging_http_transport.go:162 User-Agent=Go-http-client/1.1 tf_http_req_body="forceStop=1&timeout=1800" tf_mux_provider=tf5to6server.v5tov6Server tf_resource_type=proxmox_virtual_environment_vm @module=proxmox Host=192.168.90.216:8006 tf_http_req_uri=/api2/json/nodes/pve/qemu/100/status/shutdown tf_req_id=9e3b2a5b-4ed4-bf35-99f2-490028855609 timestamp="2024-05-03T03:13:06.860+0200"
2024-05-03T03:13:06.884+0200 [DEBUG] provider.terraform-provider-proxmox_v0.55.0.exe: Received HTTP Response: tf_mux_provider=tf5to6server.v5tov6Server tf_rpc=ApplyResourceChange Date="Fri, 03 May 2024 01:13:07 GMT" tf_http_op_type=response tf_http_res_body="{\"data\":\"UPID:pve:00001ED0:00035693:66343A23:qmshutdown:100:terraform@pve!provider:\"}" tf_http_res_version=HTTP/1.1 @module=proxmox tf_http_trans_id=974223b6-e237-5aaf-4235-81d57dbbb85d tf_provider_addr=registry.terraform.io/bpg/proxmox tf_req_id=9e3b2a5b-4ed4-bf35-99f2-490028855609 Expires="Fri, 03 May 2024 01:13:07 GMT" tf_http_res_status_reason="200 OK" tf_resource_type=proxmox_virtual_environment_vm Cache-Control=max-age=0 Content-Length=85 Content-Type=application/json;charset=UTF-8 @caller=github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/logging/logging_http_transport.go:162 Pragma=no-cache Server=pve-api-daemon/3.0 tf_http_res_status_code=200 timestamp="2024-05-03T03:13:06.884+0200"
2024-05-03T03:13:06.884+0200 [DEBUG] provider.terraform-provider-proxmox_v0.55.0.exe: Sending HTTP Request: tf_http_req_method=GET tf_provider_addr=registry.terraform.io/bpg/proxmox tf_req_id=9e3b2a5b-4ed4-bf35-99f2-490028855609 tf_resource_type=proxmox_virtual_environment_vm @module=proxmox Host=192.168.90.216:8006 User-Agent=Go-http-client/1.1 tf_http_req_body="" tf_http_trans_id=32b42409-5d55-5b59-d3c1-46f9ef9751ce tf_rpc=ApplyResourceChange @caller=github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/logging/logging_http_transport.go:162 tf_mux_provider=tf5to6server.v5tov6Server Accept=application/json Accept-Encoding=gzip Authorization="PVEAPIToken=terraform@pve!provider=REDACTED" tf_http_op_type=request tf_http_req_uri="/api2/json/nodes/pve/tasks/UPID:pve:00001ED0:00035693:66343A23:qmshutdown:100:terraform@pve%21provider:/status" tf_http_req_version=HTTP/1.1 timestamp="2024-05-03T03:13:06.884+0200"
2024-05-03T03:13:06.896+0200 [DEBUG] provider.terraform-provider-proxmox_v0.55.0.exe: Received HTTP Response: tf_provider_addr=registry.terraform.io/bpg/proxmox tf_http_op_type=response tf_http_res_status_reason="200 OK" Server=pve-api-daemon/3.0 tf_http_res_body="{\"data\":{\"node\":\"pve\",\"id\":\"100\",\"starttime\":1714698787,\"pid\":7888,\"type\":\"qmshutdown\",\"upid\":\"UPID:pve:00001ED0:00035693:66343A23:qmshutdown:100:terraform@pve!provider:\",\"user\":\"terraform@pve\",\"status\":\"running\",\"pstart\":218771,\"tokenid\":\"provider\"}}" tf_http_res_status_code=200 tf_http_res_version=HTTP/1.1 tf_http_trans_id=32b42409-5d55-5b59-d3c1-46f9ef9751ce @caller=github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/logging/logging_http_transport.go:162 @module=proxmox tf_resource_type=proxmox_virtual_environment_vm tf_rpc=ApplyResourceChange Content-Length=251 Expires="Fri, 03 May 2024 01:13:07 GMT" tf_mux_provider=tf5to6server.v5tov6Server tf_req_id=9e3b2a5b-4ed4-bf35-99f2-490028855609 Cache-Control=max-age=0 Connection=[Keep-Alive, Keep-Alive] Content-Type=application/json;charset=UTF-8 Date="Fri, 03 May 2024 01:13:07 GMT" Pragma=no-cache timestamp="2024-05-03T03:13:06.896+0200"
2024-05-03T03:13:07.907+0200 [DEBUG] provider.terraform-provider-proxmox_v0.55.0.exe: Sending HTTP Request: Accept=application/json User-Agent=Go-http-client/1.1 tf_http_req_body="" tf_http_req_version=HTTP/1.1 tf_mux_provider=tf5to6server.v5tov6Server tf_rpc=ApplyResourceChange Host=192.168.90.216:8006 tf_resource_type=proxmox_virtual_environment_vm tf_http_trans_id=658ab689-a34c-4f7a-233a-c89388ab55af @caller=github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/logging/logging_http_transport.go:162 @module=proxmox tf_http_op_type=request tf_http_req_method=GET tf_http_req_uri="/api2/json/nodes/pve/tasks/UPID:pve:00001ED0:00035693:66343A23:qmshutdown:100:terraform@pve%21provider:/status" Accept-Encoding=gzip Authorization="PVEAPIToken=terraform@pve!provider=REDACTED" tf_provider_addr=registry.terraform.io/bpg/proxmox tf_req_id=9e3b2a5b-4ed4-bf35-99f2-490028855609 timestamp="2024-05-03T03:13:07.907+0200"
2024-05-03T03:13:07.914+0200 [DEBUG] provider.terraform-provider-proxmox_v0.55.0.exe: Received HTTP Response: @caller=github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/logging/logging_http_transport.go:162 Content-Type=application/json;charset=UTF-8 Date="Fri, 03 May 2024 01:13:08 GMT" Pragma=no-cache tf_http_op_type=response tf_http_res_body="{\"data\":{\"pid\":7888,\"starttime\":1714698787,\"id\":\"100\",\"node\":\"pve\",\"tokenid\":\"provider\",\"status\":\"running\",\"pstart\":218771,\"user\":\"terraform@pve\",\"upid\":\"UPID:pve:00001ED0:00035693:66343A23:qmshutdown:100:terraform@pve!provider:\",\"type\":\"qmshutdown\"}}" tf_req_id=9e3b2a5b-4ed4-bf35-99f2-490028855609 @module=proxmox Content-Length=251 tf_rpc=ApplyResourceChange Cache-Control=max-age=0 Connection=[Keep-Alive, Keep-Alive] Expires="Fri, 03 May 2024 01:13:08 GMT" Server=pve-api-daemon/3.0 tf_http_res_status_code=200 tf_http_res_status_reason="200 OK" tf_http_res_version=HTTP/1.1 tf_http_trans_id=658ab689-a34c-4f7a-233a-c89388ab55af tf_mux_provider=tf5to6server.v5tov6Server tf_provider_addr=registry.terraform.io/bpg/proxmox tf_resource_type=proxmox_virtual_environment_vm timestamp="2024-05-03T03:13:07.913+0200"
2024-05-03T03:13:08.917+0200 [DEBUG] provider.terraform-provider-proxmox_v0.55.0.exe: Sending HTTP Request: User-Agent=Go-http-client/1.1 tf_http_req_version=HTTP/1.1 tf_req_id=9e3b2a5b-4ed4-bf35-99f2-490028855609 @caller=github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/logging/logging_http_transport.go:162 Accept-Encoding=gzip Authorization="PVEAPIToken=terraform@pve!provider=REDACTED" tf_http_req_uri="/api2/json/nodes/pve/tasks/UPID:pve:00001ED0:00035693:66343A23:qmshutdown:100:terraform@pve%21provider:/status" tf_rpc=ApplyResourceChange @module=proxmox tf_http_op_type=request tf_http_req_body="" tf_provider_addr=registry.terraform.io/bpg/proxmox tf_resource_type=proxmox_virtual_environment_vm Accept=application/json Host=192.168.90.216:8006 tf_http_req_method=GET tf_http_trans_id=b6cb27f7-977a-9c82-71a5-57d2764d220c tf_mux_provider=tf5to6server.v5tov6Server timestamp="2024-05-03T03:13:08.917+0200"
2024-05-03T03:13:08.924+0200 [DEBUG] provider.terraform-provider-proxmox_v0.55.0.exe: Received HTTP Response: tf_http_res_status_code=200 tf_req_id=9e3b2a5b-4ed4-bf35-99f2-490028855609 @caller=github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/logging/logging_http_transport.go:162 Date="Fri, 03 May 2024 01:13:09 GMT" Server=pve-api-daemon/3.0 tf_http_res_status_reason="200 OK" tf_http_trans_id=b6cb27f7-977a-9c82-71a5-57d2764d220c tf_provider_addr=registry.terraform.io/bpg/proxmox Cache-Control=max-age=0 Connection=[Keep-Alive, Keep-Alive] Content-Length=251 Content-Type=application/json;charset=UTF-8 tf_http_res_body="{\"data\":{\"upid\":\"UPID:pve:00001ED0:00035693:66343A23:qmshutdown:100:terraform@pve!provider:\",\"type\":\"qmshutdown\",\"user\":\"terraform@pve\",\"tokenid\":\"provider\",\"pstart\":218771,\"status\":\"running\",\"id\":\"100\",\"starttime\":1714698787,\"node\":\"pve\",\"pid\":7888}}" tf_http_res_version=HTTP/1.1 tf_mux_provider=tf5to6server.v5tov6Server @module=proxmox Expires="Fri, 03 May 2024 01:13:09 GMT" Pragma=no-cache tf_http_op_type=response tf_resource_type=proxmox_virtual_environment_vm tf_rpc=ApplyResourceChange timestamp="2024-05-03T03:13:08.923+0200"
2024-05-03T03:13:09.928+0200 [DEBUG] provider.terraform-provider-proxmox_v0.55.0.exe: Sending HTTP Request: @module=proxmox Authorization="PVEAPIToken=terraform@pve!provider=REDACTED" User-Agent=Go-http-client/1.1 tf_rpc=ApplyResourceChange @caller=github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/logging/logging_http_transport.go:162 Accept-Encoding=gzip tf_req_id=9e3b2a5b-4ed4-bf35-99f2-490028855609 tf_resource_type=proxmox_virtual_environment_vm tf_http_req_body="" tf_http_req_method=GET tf_http_req_uri="/api2/json/nodes/pve/tasks/UPID:pve:00001ED0:00035693:66343A23:qmshutdown:100:terraform@pve%21provider:/status" tf_http_trans_id=0316092e-42f8-ae51-ad78-71ef6ae1cf10 Accept=application/json Host=192.168.90.216:8006 tf_http_op_type=request tf_http_req_version=HTTP/1.1 tf_mux_provider=tf5to6server.v5tov6Server tf_provider_addr=registry.terraform.io/bpg/proxmox timestamp="2024-05-03T03:13:09.927+0200"
2024-05-03T03:13:09.934+0200 [DEBUG] provider.terraform-provider-proxmox_v0.55.0.exe: Received HTTP Response: Pragma=no-cache Connection=[Keep-Alive, Keep-Alive] Content-Length=251 Date="Fri, 03 May 2024 01:13:10 GMT" tf_http_res_status_code=200 tf_http_res_status_reason="200 OK" tf_req_id=9e3b2a5b-4ed4-bf35-99f2-490028855609 @caller=github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/logging/logging_http_transport.go:162 tf_resource_type=proxmox_virtual_environment_vm Expires="Fri, 03 May 2024 01:13:10 GMT" Server=pve-api-daemon/3.0 tf_http_op_type=response tf_http_res_version=HTTP/1.1 tf_http_trans_id=0316092e-42f8-ae51-ad78-71ef6ae1cf10 tf_mux_provider=tf5to6server.v5tov6Server Cache-Control=max-age=0 Content-Type=application/json;charset=UTF-8 tf_provider_addr=registry.terraform.io/bpg/proxmox tf_http_res_body="{\"data\":{\"user\":\"terraform@pve\",\"upid\":\"UPID:pve:00001ED0:00035693:66343A23:qmshutdown:100:terraform@pve!provider:\",\"type\":\"qmshutdown\",\"tokenid\":\"provider\",\"status\":\"running\",\"pstart\":218771,\"starttime\":1714698787,\"id\":\"100\",\"node\":\"pve\",\"pid\":7888}}" tf_rpc=ApplyResourceChange @module=proxmox timestamp="2024-05-03T03:13:09.934+0200"
2024-05-03T03:13:10.942+0200 [DEBUG] provider.terraform-provider-proxmox_v0.55.0.exe: Sending HTTP Request: tf_rpc=ApplyResourceChange Accept=application/json tf_http_op_type=request tf_http_req_body="" tf_http_req_uri="/api2/json/nodes/pve/tasks/UPID:pve:00001ED0:00035693:66343A23:qmshutdown:100:terraform@pve%21provider:/status" tf_http_req_version=HTTP/1.1 tf_provider_addr=registry.terraform.io/bpg/proxmox @caller=github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/logging/logging_http_transport.go:162 Authorization="PVEAPIToken=terraform@pve!provider=REDACTED" Host=192.168.90.216:8006 User-Agent=Go-http-client/1.1 tf_http_req_method=GET tf_mux_provider=tf5to6server.v5tov6Server @module=proxmox Accept-Encoding=gzip tf_http_trans_id=4796830b-4a26-f9f6-f035-97f29a5ed7a8 tf_req_id=9e3b2a5b-4ed4-bf35-99f2-490028855609 tf_resource_type=proxmox_virtual_environment_vm timestamp="2024-05-03T03:13:10.942+0200"
2024-05-03T03:13:10.949+0200 [DEBUG] provider.terraform-provider-proxmox_v0.55.0.exe: Received HTTP Response: Pragma=no-cache tf_http_res_status_code=200 tf_http_res_version=HTTP/1.1 tf_mux_provider=tf5to6server.v5tov6Server @module=proxmox Cache-Control=max-age=0 Expires="Fri, 03 May 2024 01:13:11 GMT" tf_http_res_body="{\"data\":{\"pid\":7888,\"starttime\":1714698787,\"id\":\"100\",\"node\":\"pve\",\"tokenid\":\"provider\",\"pstart\":218771,\"status\":\"running\",\"user\":\"terraform@pve\",\"upid\":\"UPID:pve:00001ED0:00035693:66343A23:qmshutdown:100:terraform@pve!provider:\",\"type\":\"qmshutdown\"}}" tf_http_res_status_reason="200 OK" tf_req_id=9e3b2a5b-4ed4-bf35-99f2-490028855609 tf_rpc=ApplyResourceChange Date="Fri, 03 May 2024 01:13:11 GMT" Server=pve-api-daemon/3.0 tf_http_trans_id=4796830b-4a26-f9f6-f035-97f29a5ed7a8 tf_resource_type=proxmox_virtual_environment_vm @caller=github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/logging/logging_http_transport.go:162 Connection=[Keep-Alive, Keep-Alive] tf_provider_addr=registry.terraform.io/bpg/proxmox Content-Length=251 Content-Type=application/json;charset=UTF-8 tf_http_op_type=response timestamp="2024-05-03T03:13:10.949+0200"
2024-05-03T03:13:11.954+0200 [DEBUG] provider.terraform-provider-proxmox_v0.55.0.exe: Sending HTTP Request: tf_http_req_version=HTTP/1.1 tf_mux_provider=tf5to6server.v5tov6Server tf_provider_addr=registry.terraform.io/bpg/proxmox tf_resource_type=proxmox_virtual_environment_vm tf_http_op_type=request @module=proxmox Accept=application/json Authorization="PVEAPIToken=terraform@pve!provider=REDACTED" Host=192.168.90.216:8006 User-Agent=Go-http-client/1.1 tf_http_req_uri="/api2/json/nodes/pve/tasks/UPID:pve:00001ED0:00035693:66343A23:qmshutdown:100:terraform@pve%21provider:/status" Accept-Encoding=gzip tf_http_req_body="" tf_http_trans_id=66985c1d-a8a6-3930-4069-8a3cf4dfe5c1 tf_rpc=ApplyResourceChange @caller=github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/logging/logging_http_transport.go:162 tf_req_id=9e3b2a5b-4ed4-bf35-99f2-490028855609 tf_http_req_method=GET timestamp="2024-05-03T03:13:11.954+0200"
2024-05-03T03:13:11.960+0200 [DEBUG] provider.terraform-provider-proxmox_v0.55.0.exe: Received HTTP Response: tf_http_res_status_reason="200 OK" tf_resource_type=proxmox_virtual_environment_vm Server=pve-api-daemon/3.0 tf_provider_addr=registry.terraform.io/bpg/proxmox @module=proxmox Cache-Control=max-age=0 Date="Fri, 03 May 2024 01:13:12 GMT" Expires="Fri, 03 May 2024 01:13:12 GMT" Pragma=no-cache tf_rpc=ApplyResourceChange @caller=github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/logging/logging_http_transport.go:162 Content-Type=application/json;charset=UTF-8 tf_http_trans_id=66985c1d-a8a6-3930-4069-8a3cf4dfe5c1 tf_mux_provider=tf5to6server.v5tov6Server tf_req_id=9e3b2a5b-4ed4-bf35-99f2-490028855609 Connection=[Keep-Alive, Keep-Alive] Content-Length=251 tf_http_op_type=response tf_http_res_body="{\"data\":{\"status\":\"running\",\"pstart\":218771,\"tokenid\":\"provider\",\"user\":\"terraform@pve\",\"upid\":\"UPID:pve:00001ED0:00035693:66343A23:qmshutdown:100:terraform@pve!provider:\",\"type\":\"qmshutdown\",\"pid\":7888,\"node\":\"pve\",\"starttime\":1714698787,\"id\":\"100\"}}" tf_http_res_status_code=200 tf_http_res_version=HTTP/1.1 timestamp="2024-05-03T03:13:11.960+0200"
2024-05-03T03:13:12.962+0200 [DEBUG] provider.terraform-provider-proxmox_v0.55.0.exe: Sending HTTP Request: Accept-Encoding=gzip tf_http_req_method=GET tf_http_req_uri="/api2/json/nodes/pve/tasks/UPID:pve:00001ED0:00035693:66343A23:qmshutdown:100:terraform@pve%21provider:/status" tf_mux_provider=tf5to6server.v5tov6Server Accept=application/json Host=192.168.90.216:8006 tf_http_req_version=HTTP/1.1 tf_provider_addr=registry.terraform.io/bpg/proxmox tf_resource_type=proxmox_virtual_environment_vm tf_rpc=ApplyResourceChange @caller=github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/logging/logging_http_transport.go:162 Authorization="PVEAPIToken=terraform@pve!provider=REDACTED" tf_http_req_body="" tf_req_id=9e3b2a5b-4ed4-bf35-99f2-490028855609 @module=proxmox User-Agent=Go-http-client/1.1 tf_http_op_type=request tf_http_trans_id=1ee9baf2-2e65-6459-99ee-48be03bc417b timestamp="2024-05-03T03:13:12.962+0200"
2024-05-03T03:13:12.968+0200 [DEBUG] provider.terraform-provider-proxmox_v0.55.0.exe: Received HTTP Response: tf_rpc=ApplyResourceChange Cache-Control=max-age=0 tf_http_res_body="{\"data\":{\"pid\":7888,\"id\":\"100\",\"starttime\":1714698787,\"node\":\"pve\",\"tokenid\":\"provider\",\"pstart\":218771,\"status\":\"running\",\"type\":\"qmshutdown\",\"upid\":\"UPID:pve:00001ED0:00035693:66343A23:qmshutdown:100:terraform@pve!provider:\",\"user\":\"terraform@pve\"}}" tf_resource_type=proxmox_virtual_environment_vm tf_provider_addr=registry.terraform.io/bpg/proxmox @module=proxmox Connection=[Keep-Alive, Keep-Alive] tf_http_res_status_reason="200 OK" tf_http_res_status_code=200 tf_mux_provider=tf5to6server.v5tov6Server Content-Length=251 Content-Type=application/json;charset=UTF-8 tf_http_op_type=response Server=pve-api-daemon/3.0 tf_http_res_version=HTTP/1.1 tf_http_trans_id=1ee9baf2-2e65-6459-99ee-48be03bc417b tf_req_id=9e3b2a5b-4ed4-bf35-99f2-490028855609 @caller=github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/logging/logging_http_transport.go:162 Date="Fri, 03 May 2024 01:13:13 GMT" Expires="Fri, 03 May 2024 01:13:13 GMT" Pragma=no-cache timestamp="2024-05-03T03:13:12.968+0200"
2024-05-03T03:13:13.972+0200 [DEBUG] provider.terraform-provider-proxmox_v0.55.0.exe: Sending HTTP Request: tf_http_req_body="" tf_http_req_uri="/api2/json/nodes/pve/tasks/UPID:pve:00001ED0:00035693:66343A23:qmshutdown:100:terraform@pve%21provider:/status" tf_mux_provider=tf5to6server.v5tov6Server tf_req_id=9e3b2a5b-4ed4-bf35-99f2-490028855609 @module=proxmox Authorization="PVEAPIToken=terraform@pve!provider=REDACTED" Host=192.168.90.216:8006 User-Agent=Go-http-client/1.1 @caller=github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/logging/logging_http_transport.go:162 Accept=application/json tf_http_req_method=GET tf_resource_type=proxmox_virtual_environment_vm tf_provider_addr=registry.terraform.io/bpg/proxmox tf_rpc=ApplyResourceChange Accept-Encoding=gzip tf_http_op_type=request tf_http_req_version=HTTP/1.1 tf_http_trans_id=32074330-1b84-5128-0673-e29a755da521 timestamp="2024-05-03T03:13:13.971+0200"
2024-05-03T03:13:13.977+0200 [DEBUG] provider.terraform-provider-proxmox_v0.55.0.exe: Received HTTP Response: Connection=[Keep-Alive, Keep-Alive] Content-Type=application/json;charset=UTF-8 Expires="Fri, 03 May 2024 01:13:14 GMT" tf_http_op_type=response Content-Length=251 Pragma=no-cache Server=pve-api-daemon/3.0 tf_http_res_body="{\"data\":{\"pid\":7888,\"node\":\"pve\",\"starttime\":1714698787,\"id\":\"100\",\"pstart\":218771,\"status\":\"running\",\"tokenid\":\"provider\",\"user\":\"terraform@pve\",\"type\":\"qmshutdown\",\"upid\":\"UPID:pve:00001ED0:00035693:66343A23:qmshutdown:100:terraform@pve!provider:\"}}" tf_http_trans_id=32074330-1b84-5128-0673-e29a755da521 tf_resource_type=proxmox_virtual_environment_vm @module=proxmox Cache-Control=max-age=0 Date="Fri, 03 May 2024 01:13:14 GMT" tf_http_res_status_code=200 tf_http_res_status_reason="200 OK" tf_req_id=9e3b2a5b-4ed4-bf35-99f2-490028855609 tf_rpc=ApplyResourceChange @caller=github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/logging/logging_http_transport.go:162 tf_http_res_version=HTTP/1.1 tf_mux_provider=tf5to6server.v5tov6Server tf_provider_addr=registry.terraform.io/bpg/proxmox timestamp="2024-05-03T03:13:13.977+0200"
2024-05-03T03:13:14.992+0200 [DEBUG] provider.terraform-provider-proxmox_v0.55.0.exe: Sending HTTP Request: tf_mux_provider=tf5to6server.v5tov6Server tf_rpc=ApplyResourceChange @module=proxmox tf_http_op_type=request tf_http_req_body="" tf_req_id=9e3b2a5b-4ed4-bf35-99f2-490028855609 tf_resource_type=proxmox_virtual_environment_vm Accept=application/json Accept-Encoding=gzip tf_http_req_method=GET tf_http_req_version=HTTP/1.1 @caller=github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/logging/logging_http_transport.go:162 Authorization="PVEAPIToken=terraform@pve!provider=REDACTED" Host=192.168.90.216:8006 tf_http_trans_id=f53fb02e-1641-1224-121e-e7a05d0a81ab tf_provider_addr=registry.terraform.io/bpg/proxmox User-Agent=Go-http-client/1.1 tf_http_req_uri="/api2/json/nodes/pve/tasks/UPID:pve:00001ED0:00035693:66343A23:qmshutdown:100:terraform@pve%21provider:/status" timestamp="2024-05-03T03:13:14.992+0200"
2024-05-03T03:13:14.998+0200 [DEBUG] provider.terraform-provider-proxmox_v0.55.0.exe: Received HTTP Response: Connection=[Keep-Alive, Keep-Alive] Date="Fri, 03 May 2024 01:13:15 GMT" tf_http_res_body="{\"data\":{\"user\":\"terraform@pve\",\"upid\":\"UPID:pve:00001ED0:00035693:66343A23:qmshutdown:100:terraform@pve!provider:\",\"type\":\"qmshutdown\",\"status\":\"running\",\"pstart\":218771,\"tokenid\":\"provider\",\"node\":\"pve\",\"starttime\":1714698787,\"id\":\"100\",\"pid\":7888}}" tf_http_res_status_code=200 tf_resource_type=proxmox_virtual_environment_vm tf_http_trans_id=f53fb02e-1641-1224-121e-e7a05d0a81ab @caller=github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/logging/logging_http_transport.go:162 Cache-Control=max-age=0 Expires="Fri, 03 May 2024 01:13:15 GMT" Pragma=no-cache tf_http_res_status_reason="200 OK" tf_mux_provider=tf5to6server.v5tov6Server tf_provider_addr=registry.terraform.io/bpg/proxmox tf_http_res_version=HTTP/1.1 tf_req_id=9e3b2a5b-4ed4-bf35-99f2-490028855609 @module=proxmox Content-Length=251 Content-Type=application/json;charset=UTF-8 Server=pve-api-daemon/3.0 tf_http_op_type=response tf_rpc=ApplyResourceChange timestamp="2024-05-03T03:13:14.998+0200"
2024-05-03T03:13:16.003+0200 [DEBUG] provider.terraform-provider-proxmox_v0.55.0.exe: Sending HTTP Request: tf_http_req_uri="/api2/json/nodes/pve/tasks/UPID:pve:00001ED0:00035693:66343A23:qmshutdown:100:terraform@pve%21provider:/status" tf_mux_provider=tf5to6server.v5tov6Server tf_resource_type=proxmox_virtual_environment_vm @caller=github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/logging/logging_http_transport.go:162 @module=proxmox Accept-Encoding=gzip tf_http_op_type=request User-Agent=Go-http-client/1.1 tf_http_req_body="" tf_provider_addr=registry.terraform.io/bpg/proxmox Accept=application/json Authorization="PVEAPIToken=terraform@pve!provider=REDACTED" Host=192.168.90.216:8006 tf_http_req_version=HTTP/1.1 tf_http_trans_id=62da1026-228d-55c5-75c3-b634a22b48af tf_http_req_method=GET tf_req_id=9e3b2a5b-4ed4-bf35-99f2-490028855609 tf_rpc=ApplyResourceChange timestamp="2024-05-03T03:13:16.003+0200"
2024-05-03T03:13:16.010+0200 [DEBUG] provider.terraform-provider-proxmox_v0.55.0.exe: Received HTTP Response: Connection=[Keep-Alive, Keep-Alive] Expires="Fri, 03 May 2024 01:13:16 GMT" Pragma=no-cache Server=pve-api-daemon/3.0 tf_provider_addr=registry.terraform.io/bpg/proxmox tf_http_res_status_code=200 tf_http_res_version=HTTP/1.1 tf_http_trans_id=62da1026-228d-55c5-75c3-b634a22b48af tf_mux_provider=tf5to6server.v5tov6Server tf_resource_type=proxmox_virtual_environment_vm tf_http_op_type=response Cache-Control=max-age=0 Content-Length=251 Content-Type=application/json;charset=UTF-8 tf_req_id=9e3b2a5b-4ed4-bf35-99f2-490028855609 @caller=github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/logging/logging_http_transport.go:162 @module=proxmox tf_http_res_status_reason="200 OK" tf_rpc=ApplyResourceChange Date="Fri, 03 May 2024 01:13:16 GMT" tf_http_res_body="{\"data\":{\"node\":\"pve\",\"id\":\"100\",\"starttime\":1714698787,\"pid\":7888,\"upid\":\"UPID:pve:00001ED0:00035693:66343A23:qmshutdown:100:terraform@pve!provider:\",\"type\":\"qmshutdown\",\"user\":\"terraform@pve\",\"status\":\"running\",\"pstart\":218771,\"tokenid\":\"provider\"}}" timestamp="2024-05-03T03:13:16.010+0200"
proxmox_virtual_environment_vm.test_01: Still destroying... [id=100, 10s elapsed]
2024-05-03T03:13:17.019+0200 [DEBUG] provider.terraform-provider-proxmox_v0.55.0.exe: Sending HTTP Request: Accept-Encoding=gzip tf_http_req_method=GET tf_mux_provider=tf5to6server.v5tov6Server tf_provider_addr=registry.terraform.io/bpg/proxmox tf_resource_type=proxmox_virtual_environment_vm tf_rpc=ApplyResourceChange tf_http_req_body="" @module=proxmox Accept=application/json Authorization="PVEAPIToken=terraform@pve!provider=REDACTED" tf_http_op_type=request tf_http_req_uri="/api2/json/nodes/pve/tasks/UPID:pve:00001ED0:00035693:66343A23:qmshutdown:100:terraform@pve%21provider:/status" @caller=github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/logging/logging_http_transport.go:162 tf_req_id=9e3b2a5b-4ed4-bf35-99f2-490028855609 tf_http_req_version=HTTP/1.1 User-Agent=Go-http-client/1.1 tf_http_trans_id=a26d2f24-6efd-901a-a6a2-658a876881b5 Host=192.168.90.216:8006 timestamp="2024-05-03T03:13:17.019+0200"
2024-05-03T03:13:17.025+0200 [DEBUG] provider.terraform-provider-proxmox_v0.55.0.exe: Received HTTP Response: tf_http_op_type=response tf_provider_addr=registry.terraform.io/bpg/proxmox Connection=[Keep-Alive, Keep-Alive] Content-Type=application/json;charset=UTF-8 Pragma=no-cache tf_http_res_status_reason="200 OK" tf_mux_provider=tf5to6server.v5tov6Server Cache-Control=max-age=0 Date="Fri, 03 May 2024 01:13:17 GMT" Content-Length=334 tf_http_res_body="{\"data\":{\"exitstatus\":\"can't lock file '/var/lock/qemu-server/lock-100.conf' - got timeout\",\"id\":\"100\",\"starttime\":1714698787,\"tokenid\":\"provider\",\"pstart\":218771,\"upid\":\"UPID:pve:00001ED0:00035693:66343A23:qmshutdown:100:terraform@pve!provider:\",\"user\":\"terraform@pve\",\"pid\":7888,\"node\":\"pve\",\"status\":\"stopped\",\"type\":\"qmshutdown\"}}" tf_http_res_status_code=200 tf_http_res_version=HTTP/1.1 tf_http_trans_id=a26d2f24-6efd-901a-a6a2-658a876881b5 @caller=github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/logging/logging_http_transport.go:162 @module=proxmox tf_req_id=9e3b2a5b-4ed4-bf35-99f2-490028855609 tf_resource_type=proxmox_virtual_environment_vm tf_rpc=ApplyResourceChange Expires="Fri, 03 May 2024 01:13:17 GMT" Server=pve-api-daemon/3.0 timestamp="2024-05-03T03:13:17.025+0200"
2024-05-03T03:13:17.026+0200 [ERROR] provider.terraform-provider-proxmox_v0.55.0.exe: Response contains error diagnostic: diagnostic_severity=ERROR @module=sdk.proto diagnostic_detail="" diagnostic_summary="error waiting for VM shutdown: task \"UPID:pve:00001ED0:00035693:66343A23:qmshutdown:100:terraform@pve!provider:\" failed to complete with exit code: can't lock file '/var/lock/qemu-server/lock-100.conf' - got timeout" tf_proto_version=6.4 tf_provider_addr=registry.terraform.io/bpg/proxmox tf_req_id=9e3b2a5b-4ed4-bf35-99f2-490028855609 @caller=github.com/hashicorp/terraform-plugin-go@v0.22.2/tfprotov6/internal/diag/diagnostics.go:58 tf_rpc=ApplyResourceChange tf_resource_type=proxmox_virtual_environment_vm timestamp="2024-05-03T03:13:17.026+0200"
2024-05-03T03:13:17.029+0200 [DEBUG] State storage *statemgr.Filesystem declined to persist a state snapshot
2024-05-03T03:13:17.029+0200 [ERROR] vertex "proxmox_virtual_environment_vm.test_01 (destroy)" error: error waiting for VM shutdown: task "UPID:pve:00001ED0:00035693:66343A23:qmshutdown:100:terraform@pve!provider:" failed to complete with exit code: can't lock file '/var/lock/qemu-server/lock-100.conf' - got timeout
╷
│ Error: error waiting for VM shutdown: task "UPID:pve:00001ED0:00035693:66343A23:qmshutdown:100:terraform@pve!provider:" failed to complete with exit code: can't lock file '/var/lock/qemu-server/lock-100.conf' - got timeout
│
│
╵
2024-05-03T03:13:17.031+0200 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2024-05-03T03:13:17.033+0200 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/bpg/proxmox/0.55.0/windows_amd64/terraform-provider-proxmox_v0.55.0.exe pid=9336
2024-05-03T03:13:17.034+0200 [DEBUG] provider: plugin exited #

Expected behavior
Virtual Machine is shut down successfully and deleted

Screenshots
image
image

Additional context

  • Single or clustered Proxmox: Single
  • Provider version (ideally it should be the latest version): 0.55.0
  • Terraform version: 1.8.2
  • OS (where you run Terraform from): Windows 11
  • Debug logs (TF_LOG=DEBUG terraform apply):
@MichalMarchewka MichalMarchewka added the 🐛 bug Something isn't working label May 3, 2024
@bpg
Copy link
Owner

bpg commented May 3, 2024

Hi @MichalMarchewka 👋🏼

From the example tf template, it doesn't looks like your VM has any OS to load. I think it is just looping though the BIOS boot sequence trying to bootstrap, but there is no bootloader available. You can check that on the VM console.

The provider can't do anything in this case, neither Proxmox UI. You can directly issue a qemu command quit via the Monitor section in the UI to terminate such VMs:
Screenshot 2024-05-03 at 5 02 51 PM

@bpg bpg added the ⌛ pending author's response Requested additional information from the reporter label May 3, 2024
@MichalMarchewka
Copy link
Author

MichalMarchewka commented May 3, 2024

Hello @bpg 👋🏻
Thank you for the quick reply. To confirm - I can shut down the VM using the PVE interface and then delete it manually. I'm just wondering if it's possible in your provider to force the virtual machine to shut down after removing it from the TF code and then delete it. I'm very new to Proxmox, I've only been playing with it for two days, but this kind of thing works in the ESXi and vSphere TF provider (even if no image isattached to the VM instance).

@MichalMarchewka
Copy link
Author

MichalMarchewka commented May 3, 2024

I've added following code to VM configuration:

cdrom {
    enabled = true
    file_id = "local:iso/ubuntu_server_au.iso"
}

VM started and ISO was loaded. When I remove the VM config from TF it's the same behaviour as before, but system is installing (no looped boot sequence this time):

  1. PVE UI says the VM is shuting down
  2. TF console says it keeps destroying

@bpg bpg removed the ⌛ pending author's response Requested additional information from the reporter label May 3, 2024
@bpg
Copy link
Owner

bpg commented May 3, 2024

Interesting... 🤔 I just want to confirm, that Shutdown from the UI works for you, but when provider does that, it hangs?

@MichalMarchewka
Copy link
Author

MichalMarchewka commented May 3, 2024

Well, not exectly to be honest. I'm not able to shutdown VM from the UI but I'm able to stop it. After I stop it manually then remove from TF, terraform apply --auto-approve successfully removes it from Proxmox.

@MichalMarchewka
Copy link
Author

MichalMarchewka commented May 3, 2024

resource "proxmox_virtual_environment_vm" "test_01" {
  name        = "test-01"
  description = "Managed by Terraform"
  tags        = ["test"]
  on_boot     = true
  node_name = "pve"

  #agent {
  #  enabled = true
  #}

  operating_system {
    type = "l26"
  }

  cpu {
    cores = 2
    type  = "host"
    numa  = true
  }

  memory {
    dedicated = 1024
  }

  disk {
    size         = "30"
    interface    = "virtio0"
    datastore_id = "local-lvm"
    file_format  = "raw"
  }

  network_device {
    bridge = "vmbr0"
    model  = "virtio"
  }

  cdrom {
    enabled = true
    file_id = "local:iso/ubuntu_server_au.iso"
  }

  initialization {
    # interface = "scsi1"
    ip_config {
      ipv4 {
        address = "dhcp"
      }
    }
  }
}

Scenario 1:

  1. Create VM resource
  2. Let it start
  3. Remove the resource from TF and apply
  4. Proxmox UI says it's shutting down, TF says it's still destroying

Scenario 2:

  1. Create VM resource
  2. Let it start
  3. Stop it manually via Proxmox UI
  4. Remove the resource from TF and apply
  5. VM is removed from Proxmox

@bpg
Copy link
Owner

bpg commented May 3, 2024

Ah... then stop_on_destroy should help 🤞🏼

@MichalMarchewka
Copy link
Author

Amazing! It's my fault I missed this argument. Thank you!

@bpg
Copy link
Owner

bpg commented May 3, 2024

No prob! 🙂 Please let me know if it works for you.

@bpg bpg added the ⌛ pending author's response Requested additional information from the reporter label May 4, 2024
@bpg
Copy link
Owner

bpg commented May 6, 2024

I assume it worked :)

@bpg bpg closed this as completed May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working ⌛ pending author's response Requested additional information from the reporter
Projects
None yet
Development

No branches or pull requests

2 participants