Open arnaudclerc opened 1 year ago
Hello, arnaudclerc! 🖐
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.
Have you tried using depends_on
?
Have you tried using
depends_on
?
Yes, in many different ways, it doesn't change the actual behaviour
(tried depending on a time resource, the last level folder, all subsequents folders)
i don't know if this is important but i'm using 2 differents modules, one for folder creation the other for VM creation, the first one outputs the folders and VM are using this output for interpolation dependency,
The code example is a bit complex to try to reflect my actual project but even with one folder and one simple vsphere_virtual_machine, the problem persists, have you been able to reproduce the error ?
…have you been able to reproduce the error ?
No. Sorry, I’ve not had availability to do so.
No. Sorry, I’ve not had availability to do so.
no prob; i'm surprised as i don't see anyone else reporting this case, i don't think my configuration is so special to cause this, and it seems to be a common use case of the resource.
I think it is bound to Terraform's way of declaring resources, i might have a solution to this but my knowledge of the Vsphere provider is close to zero and i don't see any way of exploiting it locally by building the sources.
Hi there @arnaudclerc! Could you provide a concise example so that we can reproduce and triage the issue?
Community Guidelines
Terraform
v1.3.6
Terraform Provider
v2.2.0
VMware vSphere
v7.0.3
Description
Apply and Destroy are executed perfectly,
Apply: the folder get created then VM get created inside this folder
Destroy: the VM is deleted then the folder gets deleted
Editing a folder, throws an error due to bad dependency flow: when renaming a folder, the VM depending on it waits for the new folder name to be created and the old folder name to be deleted, thus, it is no possible as the old folder name still holds the VM.
Debug Output
Expected Behavior Terraform creates new folder name, moves the VM which depends on this folder (or recursively depends on it (child of child folder case..)), then delete the old folder name when VM is successfully moved.
Actual Behavior Terraform has a race condition in which a destroy is attempted on the folder before it's empty, causing the destroy to fail.
Steps to Reproduce terraform apply [[RENAME FOLDER]]] terraform apply
Important Factoids References https://github.com/hashicorp/terraform-provider-vsphere/issues/23 https://github.com/hashicorp/terraform-provider-vsphere/issues/453
Affected Resources or Data Sources
resource/vsphere_folder resource/vsphere_virtual_machine
Terraform Configuration
Debug Output
https://gist.github.com/arnaudclerc/c5b5a9824bc4209d251d628a935b8b10
Panic Output
No response
Expected Behavior
Actual Behavior
the folder that needs to be renamed is being deleted the re-created under its new name before the VM have been able to be move to the corresponding path.
the deletion of folder's old name crashes because VM is still in it.
Steps to Reproduce
apply once, rename the folder of the VM, apply a second time
Environment Details
No response
Screenshots
No response
References
No response