-
Notifications
You must be signed in to change notification settings - Fork 449
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
add a disk on a exists vm will recreate this VM #2233
Comments
Hello, johng521888! 🖐 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. |
Hey @johng521888 I tried this myself, I added both a simple Can you try updating your provider to the latest version? |
Hi spacegospod,
#} 2、create another disk use below tf 3、Uncomment virtual machine second disk in main.tf and execute terraform apply in virtual machine module resource "vsphere_virtual_machine" "vm" {
} plan:1 to add, 0 to change, 1 to destroy. I don't know why this happens, can I avoid destroying my virtual machine? Because not everyone knows at the beginning whether they want to add a second disk |
Adding a disk shouldn't just by itself be able to force a VM to get re-created. I'd be curious to see the output just above |
Thank you @spacegospod. My VM network name contains special symbols, and terraform cannot recognize this symbol "/", which causes the life cycle of the created VM to fail to complete normally. |
Thank you for the update, I'm going to close the ticket now. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Community Guidelines
Terraform
1.7.1
Terraform Provider
2.6.1
VMware vSphere
7.0.3
Description
I modified main.tf and tried to add a disk to an existing VM. Terraform apply will recreate my VM, which will cause data loss. Is there any way to avoid the re-creation?
Affected Resources or Data Sources
resource/vsphere_virtual_machine
Terraform Configuration
1、create vsphere vm from template with only one disk first
2、add another disk to the vsphere_virtual_machine resource
Debug Output
vsphere_virtual_machine.vm:Destroying... [id=422de896-1dbe-6669-d019-fa8e69afd15f]
Panic Output
No response
Expected Behavior
when I add a new disk to an existing VM, I want to avoid recreating the VM after executing terraform apply.
Actual Behavior
add new disk will recreate VM
Steps to Reproduce
1、use terraform create an VM with only one disk instance
2、use terraform create an disk
3、Modify the main.tf file of the virtual machine and bind the disk created in the second step to the virtual machine
4、apply this VM will destroy and recreate this VM
Environment Details
No response
Screenshots
No response
References
#434
The text was updated successfully, but these errors were encountered: