Giter VIP home page Giter VIP logo

Comments (10)

bpg avatar bpg commented on August 9, 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

from terraform-provider-proxmox.

MichalMarchewka avatar MichalMarchewka commented on August 9, 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).

from terraform-provider-proxmox.

MichalMarchewka avatar MichalMarchewka commented on August 9, 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

from terraform-provider-proxmox.

bpg avatar bpg commented on August 9, 2024

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

from terraform-provider-proxmox.

MichalMarchewka avatar MichalMarchewka commented on August 9, 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.

from terraform-provider-proxmox.

MichalMarchewka avatar MichalMarchewka commented on August 9, 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

from terraform-provider-proxmox.

bpg avatar bpg commented on August 9, 2024

Ah... then stop_on_destroy should help 🤞🏼

from terraform-provider-proxmox.

MichalMarchewka avatar MichalMarchewka commented on August 9, 2024

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

from terraform-provider-proxmox.

bpg avatar bpg commented on August 9, 2024

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

from terraform-provider-proxmox.

bpg avatar bpg commented on August 9, 2024

I assume it worked :)

from terraform-provider-proxmox.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.