Open jtognazzi opened 2 weeks ago
Hello, jtognazzi! 🖐
Thank you for submitting an issue for this provider. The issue will now enter into the issue lifecycle.
If you want to contribute to this project, please review the contributing guidelines and information on submitting pull requests.
Also encountered this issue today when attaching drives created with vsphere_virtual_disk in different module to existing VMs.
Same observed in our infrastructure, in the context of one VM repeatedly provisioning with disks enumerated in an "unexpected" order (e.g. system disk on /dev/sde). We worked around the issue by considering the PCI enumeration is more stable, and by using the /dev/disk/by-path/pci-(...)-scsi-0:0:<index>:0-part1
as device name in our cloud-config, which match the order in which disks are declared in the VM resource.
Community Guidelines
Terraform
1.9.8
Terraform Provider
2.10.0
VMware vSphere
8.0.3
Description
When Creating a VM with 1 or multiple disks you can properly use the disk uuid in other resources or in locals variables. the value is only known after apply, but it works properly.
Now, if you add some other disks on a VM which already exists, it does not work anymore as the disk uuid is not shown as known after apply, and if you have resources relying on it it fails because it is null.
Affected Resources or Data Sources
resource/vsphere_virtual_machine
Terraform Configuration
Debug Output
https://gist.github.com/jtognazzi/10f79a78405566dc1512e7a620e4b505
Panic Output
No response
Expected Behavior
The uuid of all attached disk should be shown in output and
Actual Behavior
It fails with the following error
terraform apply -var 'datadisks=["disk1"]'
Edit: I added the terraform_data resource and now the error is
Steps to Reproduce
var.datadisks
is an empty list per default. So runningterraform apply
will create a new VM with only 1 disk attached then runningterraform apply -var 'datadisks=["disk1"]'
will attach another disk to the VM, but it fails.If I destroy everything and run directly the same command (so the VM has 2 disks attached), it works properly.
Environment Details
No response
Screenshots
No response
References
No response