Comments (6)
Hey @johng521888 I tried this myself, I added both a simple
disk
block and one with a path to an existing vmdk. Neither of these destroy the VM, they just reconfigure it. I ran this experiment on a basic VM and on one that I created from a template.Can you try updating your provider to the latest version? If you continue to encounter this problem please share your configuration and the output from
terraform plan
so that we can see the diff
Hi spacegospod,
i have tried today. but have same issue in version 2.8.2 vsphere provider. i have two modules as below
1、vshereVM(to create a machine)
resource "vsphere_virtual_machine" "vm" {
name=var.hostname
num_cpus = var.vcpu
memory = var.memory
datastore_id = xxx
resource_pool_id = xxx
guest_id = xxx
scsi_type = xxx
disk {
lable = "disk0"
size = var.disk_size
eagerly_scrub = xxx
thin_provisioned = xxx
}
#disk {
#attach = true
#path = "xxxx/thisistestdisk.vmdk"
#label = "disk1"
#datastore_id = xxx
#unit_number = 1
#io_limit = 3000
#}
......
......
}
first time i create this machine with one disk use terraform apply
2、create another disk use below tf
resource "vsphere_virtual_disk" "virtual_disk" {
size = 100
vmdk_path = first_create_machine_UUID/thisistestdisk.vmdk
datacenter = same_machine_datacenter
datasotore = same_machine_datastore
}
3、Uncomment virtual machine second disk in main.tf and execute terraform apply in virtual machine module
resource "vsphere_virtual_machine" "vm" {
name=var.hostname
num_cpus = var.vcpu
memory = var.memory
datastore_id = xxx
resource_pool_id = xxx
guest_id = xxx
scsi_type = xxx
disk {
lable = "disk0"
size = var.disk_size
eagerly_scrub = xxx
thin_provisioned = xxx
}
disk {
attach = true
path = first_create_machine_UUID/thisistestdisk.vmdk
label = "disk1"
datastore_id = xxx
unit_number = 1
io_limit = 3000
}
......
......
}
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
from terraform-provider-vsphere.
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.
from terraform-provider-vsphere.
Hey @johng521888 I tried this myself, I added both a simple disk
block and one with a path to an existing vmdk.
Neither of these destroy the VM, they just reconfigure it.
I ran this experiment on a basic VM and on one that I created from a template.
Can you try updating your provider to the latest version?
If you continue to encounter this problem please share your configuration and the output from terraform plan
so that we can see the diff
from terraform-provider-vsphere.
Adding a disk shouldn't just by itself be able to force a VM to get re-created.
Have any changes been made to this VM outside of Terraform?
I'd be curious to see the output just above 1 to add, 0 to change, 1 to destroy.
Terraform should display the configuration diff.
It would also be useful to run the provider with TF_LOG
set to TRACE
and share the detailed logs, just make sure to obfuscate any potentially sensitive data.
from terraform-provider-vsphere.
Thank you @spacegospod.
i have solved this problem. the reason is that the instance lifycycle has not been completed. so each apply operation will also recreate the vm.
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.
from terraform-provider-vsphere.
Thank you for the update, I'm going to close the ticket now.
Feel free to re-open if you need assistance
from terraform-provider-vsphere.
Related Issues (20)
- Add support for [or cluster for 3 zone Deployments HOT 3
- error: error reconfiguring virtual machine: error reconfiguring virtual machine: Invalid operation for device '0' HOT 3
- `customize { windows_options { domain_ou` path containing spaces fails with error HOT 17
- Unable to create/add additional disks to virtual machine HOT 4
- domain_ou unable to find proper ou and dc HOT 5
- error: error reconfiguring virtual machine: error reconfiguring virtual machine: Invalid operation for device '0' HOT 3
- Virtual machine is rebooted when a new SCSI Controller is added to the machine HOT 1
- custom_attributes are not applying to vsphere_vapp_container resource HOT 6
- Add support for adding notes to vsphere_vapp_container HOT 4
- Add support for custom_attributes in resource vsphere_vapp_container HOT 1
- The resource vim.dvs.DistributedVirtualPort is not available in vim.dvs.DistributedVirtualPortgroup HOT 6
- Add support for shutdown or start VM HOT 1
- Creating r/virtual_machine with multiple PCI passthrough devices is not supported
- Plugin did not respond : Stack trace from the terraform-provider-vsphere_v2.8.2_x5.exe plugin HOT 5
- provider is not using HTTPS_PROXY variable HOT 2
- Error: error cloning virtual machine: A specified parameter was not correct: spec.disk.backing.crypto HOT 1
- Needing help with pull request for vapp_transport HOT 1
- Deleting larger datastores with `vsphere_vmfs_datastore` times out HOT 4
- Use of NewFinder with all=true requires root vCenter permissions HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from terraform-provider-vsphere.