Open grothja opened 1 year ago
Hello, grothja! π
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.
I circled back to this, and found that there isn't a bug with creating two disks, but maybe a bug (or possible enhancement) for displaying which disks are being created.
For other's sake, my Packer vsphere-clone
config contained this for the VM template, which I thought was creating the root volume:
source "vsphere-clone" "rocky" {
...
storage {
disk_size = 40000
disk_thin_provisioned = true
}
}
But was in reality creating an extra disk.
With that though, when looking at the vSphere template in a TF data source, it was only showing a single disk:
"disks" = tolist([
{
"eagerly_scrub" = false
"label" = "Hard disk 1"
"size" = 40
"thin_provisioned" = true
"unit_number" = 0
},
])
And as seen above, when creating, it only showed a single disk block for disks being created. It's possible this is related to how vSphere presents this information, and as such there's nothing this Terraform provider can do, but ideally it would show that two disks are being created.
If this is not a TF provider issue though, feel free to close this out.
I am running into the same issue as you. But I am using RHEL and vSphere 8. I thought it might be because the disk size does not match with the disk size in the template. But when I try to access the templates disks, I get the following error:
β 118: size = data.vsphere_virtual_machine.rhel_template.disks.0.size
β βββββββββββββββββ
β β data.vsphere_virtual_machine.rhel_template.disks is empty list of object
β
β The given key does not identify an element in this collection value: the collection has no elements.
Something seems to be off here, but I cannot put a finger on it yet. I am doing some more troubleshooting and then might open up a separate issue for my problem.
I think I have the same issue!
I created my VMs with disk.label = "disk0"
as per recommendations:
The disks must have a label argument assigned in a convention matching diskN, starting with disk number 0, based on each virtual disk order on the SCSI bus. As an example, a disk on SCSI controller 0 with a unit number of 0 would be labeled as disk0, a disk on the same controller with a unit number of 1 would be disk1, but the next disk, which is on SCSI controller 1 with a unit number of 0, still becomes disk2.
Yet, when I wanted to recreate my state my importing the VM, I ended up with a diff like this:
Changing disk.label = "Hard disk 1"
seems to fix that issue, I no longer get a diff indicating any disk deletion.
Community Guidelines
Terraform
1.5.1
Terraform Provider
2.4.1
VMware vSphere
7.0.3
Description
When I create a VM cloned from a template, two hard disks are being created, but I'm only specifying a single
disk {}
block. The primary root//dev/sda
device will match what is in thedisk
block (e.g., if I specify 50GB, Hard Disk 1 in vSphere will be 50GB), and the second device always matches the template disk size (40GB)It's definitely possible I'm just missing something obvious, but I've searched through the issues in this repo and wasn't able to come up with anything...
Affected Resources or Data Sources
resource/vsphere_virtual_machine
Terraform Configuration
Debug Output
Plan output:
Panic Output
No response
Expected Behavior
A single disk created instead of two
Actual Behavior
two disks are created
Steps to Reproduce
I've tested this against multiple vSphere provider versions with no luck...
Environment Details
No response
Screenshots
No response
References
No response