0
0
mirror of https://github.com/bpg/terraform-provider-proxmox.git synced 2025-08-22 19:38:35 +00:00

chore(docs): add example for host disk pass-through to VM (#1547)

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
This commit is contained in:
Pavel Boldyrev 2024-09-21 09:49:54 -04:00 committed by GitHub
parent b5a4e32d7a
commit e23d2f375c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -631,12 +631,12 @@ VM `data_user_vm` attaches those disks as `scsi1` and `scsi2`.
**VM `data_user_vm` can be *re-created/replaced* without losing data stored on disks
owned by `data_vm`.**
This functionality is **experimental**.
~> **Experimental** Please test your configuration first in an environment where you can tolerate the potential data loss.
Do *not* simultaneously run more than one VM using same disk. For most filesystems,
~> Do *not* simultaneously run more than one VM using same disk. For most filesystems,
attaching one disk to multiple VM will cause errors or even data corruption.
Do *not* move or resize `data_vm` disks.
~> Do *not* move or resize `data_vm` disks.
(Resource `data_user_vm` should reject attempts to move or resize non-owned disks.)
```hcl
@ -688,6 +688,37 @@ resource "proxmox_virtual_environment_vm" "data_user_vm" {
}
````
## Example: Disk pass-through
You can attach another physical disk from the PVE host to a VM.
This is done by setting the `path_in_datastore` to the path of the block device on the host.
~> **Experimental** Please test your configuration first in an environment where you can tolerate the potential data loss.
~> Do *not* attach the same disk to more than one VM as it may cause data corruption.
```hcl
resource "proxmox_virtual_environment_vm" "test_vm" {
...
# boot disk
disk {
...
}
# attached disk
disk {
datastore_id = ""
path_in_datastore = "/dev/path/to/block/device"
file_format = "raw"
}
...
}
```
## Import
Instances can be imported using the `node_name` and the `vm_id`, e.g.,