hashicorp / terraform-provider-vsphere

Terraform Provider for VMware vSphere
https://registry.terraform.io/providers/hashicorp/vsphere/
Mozilla Public License 2.0
611 stars 450 forks source link

Terraform code working on thin provision disk template but when i am trying to clone it from thik provisioning disk template it not worked . #1913

Open Swati1999-kag opened 1 year ago

Swati1999-kag commented 1 year ago

Community Guidelines

Terraform

Terraform v1.4.5

Terraform Provider

v1.15.0

VMware vSphere

v7.0.3

Description

We are trying to clone vm from vmware template using vsphere provider vc version -7.0.2 Terraform v1.4.5

Terraform code working on thin provision disk template but when i am trying to clone it from thik provisioning disk template it not worked . Getting below error- Error: disk.0: virtual disk "disk0": virtual disks cannot be shrunk (old: 60 new: 25) │ │ with vsphere_virtual_machine.vm["prod"], │ on main.tf line 25, in resource "vsphere_virtual_machine" "vm": │ 25: resource "vsphere_virtual_machine" "vm" {

rightnow we have added like below -below configuration are working for thin provisioning

dynamic "disk" { for_each = [ for disk in data.vsphere_virtual_machine.template.disks: disk ]

content { label = "disk${disk.key}" unit_number = disk.key size = disk.value.size } }

For thick provisiong we tried to add below -

eagerly_scrub = false thin_provisioned = false

Please assist here.

Affected Resources or Data Sources

virtual machines

Terraform Configuration

dynamic "disk" { for_each = [ for disk in data.vsphere_virtual_machine.template.disks: disk ]

content { label = "disk${disk.key}" unit_number = disk.key size = disk.value.size } }

Debug Output

Error: disk.0: virtual disk "disk0": virtual disks cannot be shrunk (old: 60 new: 25) │ │ with vsphere_virtual_machine.vm["prod"], │ on main.tf line 25, in resource "vsphere_virtual_machine" "vm": │ 25: resource "vsphere_virtual_machine" "vm" {

Panic Output

No response

Expected Behavior

It should be work on both thin and thick provision hard disks template.

Actual Behavior

we are able to create clone from Think disk template ,but we are unable to create clone from thick provision templates.

Steps to Reproduce

terraform plan

Environment Details

No response

Screenshots

No response

References

No response

github-actions[bot] commented 1 year ago

Hello, Swati1999-kag! 🖐

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.