-
-
Notifications
You must be signed in to change notification settings - Fork 143
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
proxmox_virtual_environment_vm: cdrom / disk import issue #1372
Comments
Sorry, still didn't get it... If it is an .iso file, would you rather attach as a EDIT: just saw your uploaded screenshot. Yes, it should be |
well, gave it a go changing the proxmox_virtual_environment_vm.foo: Modifying... [id=100]
|
| Error: deletion of disks not supported. Please delete disk by hand. Old interface was "ide2"
|
| with proxmox_virtual_environment_vm.foo,
| on virtual_vms.tf line 40, in resource "proxmox_virtual_environment_vm" "foo":
| 40: resource "proxmox_virtual_environment_vm" "foo" { nuking that and starting fresh; a clean import and the next plan yields: # proxmox_virtual_environment_vm.foo will be updated in-place
~ resource "proxmox_virtual_environment_vm" "foo" {
id = "100"
name = "foo"
tags = [
"archlinux",
"terraform",
]
# (27 unchanged attributes hidden)
+ cdrom {
+ enabled = true
+ file_id = "local-btrfs:iso/archlinux-2024.06.01-x86_64.iso"
+ interface = "ide2"
}
~ disk {
~ file_format = "iso" -> "raw"
~ interface = "ide2" -> "scsi0"
~ iothread = false -> true
~ path_in_datastore = "iso/archlinux-2024.03.29-x86_64.iso" -> "100/vm-100-disk-0.raw"
~ size = 0 -> 32
# (7 unchanged attributes hidden)
}
- disk {
- aio = "io_uring" -> null
- backup = true -> null
- cache = "none" -> null
- datastore_id = "local-btrfs" -> null
- discard = "ignore" -> null
- file_format = "raw" -> null
- interface = "scsi0" -> null
- iothread = true -> null
- path_in_datastore = "100/vm-100-disk-0.raw" -> null
- replicate = true -> null
- size = 32 -> null
- ssd = false -> null
}
# (5 unchanged blocks hidden)
}
ran the apply and it errors: | Error: deletion of disks not supported. Please delete disk by hand. Old interface was "ide2"
|
| with proxmox_virtual_environment_vm.foo,
| on virtual_vms.tf line 40, in resource "proxmox_virtual_environment_vm" "foo":
| 40: resource "proxmox_virtual_environment_vm" "foo" {
| and a subsequent plan + apply and all is healthy; i think this bug is now just an import issue |
Hi,
Is this okay or is it a bug? |
Hi @gustavodrodriguez 👋🏼 This is a known limitation (hence the proper error message) due to the current VM resource format. Each This leads to major issues with state reconciliation. Imagine you have disks like ['scsi0', 'sata1']. If you remove 'scsi0' and add 'sata2' at the end, the new list would look like ['sata1', 'sata2']. From the provider's perspective, both disk devices appear to be updated: 'scsi0' -> 'sata1', 'sata1' -> 'sata2' (interfaces and all other disk attributes), which is obviously incorrect. A proper fix for this issue will come with #1231, where I plan to change the disk format from a list to a map. Here is a prototype of the same change for |
Describe the bug
proxmox_virtual_environment_vm's disk size can be equal to 0; current limitations require it to be greater or equal to 1
To Reproduce
Steps to reproduce the behavior:
tofu import proxmox_virtual_environment_vm.foo foo/100
~disk { ~size = 0 -> 8
in plan outputError: expected size to be at least (1), got 0
Please also provide a minimal Terraform configuration that reproduces the issue.
note the
disk
sectionrunning
tofu plan
yields:Expected behavior
tofo plan to allow disk-size = 0
Additional context
tested patching
proxmoxtf/resource/vm/disk/schema.go
L134 (ValidateDiagFunc: validation.ToDiagFunc(validation.IntAtLeast(1)),
) ; set the1
to0
and seems to make the issue go away (though I did not get to running tofo apply yet due to other fun things )edit1: apply actualy gives like 50 "legacy plugin sdk" potential problems and eventually runs into an out-of-range panic (panic is also on stock 0.59.0 and digging into that
edit2: got tofu apply running with the L134 tweak above; trying to use the stock 0.59.0 with
size = 0
fails, as well as settingsize = 1
(due to it being an iso). (panic i got from edit1 was due to incomplete blocks i never cleaned up from example vm resource)TF_LOG=DEBUG terraform apply
): n/aThe text was updated successfully, but these errors were encountered: