hashicorp / hashicorp/packer-plugin-proxmox

Add Option to Destroy Unreferenced Disks Owned by Guest

Open
#331 0 comments 4 reactions 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
223
Forks
102
Avg merge
8h 37m
Merged PRs (30d)
1

Description

#### Community Note

Please vote on this issue by adding a 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to help the community and maintainers prioritize this request.
Please do not leave "+1" or "me too" comments – they generate extra noise for issue followers and do not help prioritize the request.
If you are interested in working on this issue or have submitted a pull request, please leave a comment.

---

#### Description

This feature request proposes adding support for the **"Destroy unreferenced disks owned by guest"** option when destroying a VM, as shown in the Proxmox UI confirmation dialog. This allows for automatic cleanup of orphaned or detached disk volumes that belong to the guest VM but are no longer referenced in the config.

The referenced setting appears in the GUI destroy confirmation dialog and affects only disks no longer referenced in the VM configuration. This option is especially useful for managing storage resources efficiently in environments where stale or orphaned disks might persist after broken build pipelines or testing workflows.

---

#### Use Case(s)

- Automatically clean up unreferenced guest-owned disks when destroying VMs, reducing manual cleanup effort.
- Prevent accumulation of unused storage volumes that are no longer attached to any VM.
- Improve automation in CI pipelines, ephemeral VM lifecycles, and temporary environments.
- Support parity with Proxmox GUI functionality when using API- or CLI-based workflows.

---

#### Potential Configuration

#### Packer example:

```hcl
"builders": [
{
"type": "proxmox-iso",
"destroy_unreferenced_disks": true,
# ...
}
```

#### CLI example:

```bash
qm destroy 117 --destroy-unreferenced-disks 1
```

---

### Potential References

- Proxmox GUI VM destroy confirmation dialog includes a checkbox:
> [✓] Destroy unreferenced disks owned by guest
> Referenced disks will always be destroyed.

- [`qm destroy` documentation](https://pve.proxmox.com/pve-docs/qm.1.html)
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.