Open NilsBusche opened 3 years ago
Any news on this one? This is still an issue with VCD 10.3.
This breaks our automated VM deployments.
vcd_vapp.vapp: Creation complete after 2s [id=urn:vcloud:vapp:fee69b93-6fa7-457c-87b4-fd3d36358081]
vcd_vapp_org_network.vappnetattach: Creating...
vcd_vapp_access_control.vappacl: Creating...
vcd_vapp_org_network.vappbackupnetattach[0]: Creating...
vcd_vapp_org_network.vappnetattach: Creation complete after 5s [id=urn:vcloud:network:f11b5312-a231-4ebb-ad85-e887049f1198]
vcd_vapp_access_control.vappacl: Creation complete after 6s [id=urn:vcloud:vapp:fee69b93-6fa7-457c-87b4-fd3d36358081]
Error: error creating vApp org network. &errors.errorString{s:"error updating vApp Network: API Error: 400: [ 4ea08867-49e1-4b74-a76b-676a199f6ab2 ] The entity Ref: com.vmware.vcloud.entity.vapp:fee69b93-6fa7-457c-87b4-fd3d36358081 is busy completing an operation VDC_COMPOSE_VAPP. VDC_COMPOSE_VAPP(com.vmware.vcloud.entity.task:b329b049-8133-4b22-aa17-ff4616964584)"}
Edit: I looks like the issue occur more often if you attach 2 vapp networks. My case uses vcd_vapp_org_network 2 times and a vcd_vapp_access_control.
Reproducing this issue is quite difficult. I was able to do it by adding yet another network to the configuration, and running apply/destroy in a loop. After 18 iterations, it failed. We'll look into it.
@NilsBusche does the fix you recommend (moving the wait block outside the guest property if
) solve the issue for you?
Hello @dataclouder : Since you was able to reproduce the issue with more vcd_vapp_org_network I have another theorie:
We had discussion in the past that "vCd allows only one action per vApp" [1] Maybe this is valid for vcd_vapp_org_network as well? Maybe a vcd_vapp_org_network makes a vapp busy? Does the provider make sure only one vcd_vapp_org_network action is performed at a time instead of in parallel (similar to vapp_vm)?
[1] https://github.com/vmware/terraform-provider-vcd/issues/507#issuecomment-629935300
@jpbuecken Thanks for your analysis. This could be one of the contributing causes. However, all functions to create or modify vApp networks are properly locking access to the parent vApp.
There is a line of investigation that I can pursue, however. In vApp, there is a lock on Creation (which invokes Update), but not on update itself. Now, this is something that we must check carefully, because can create issues, but not in this specific test case, where the vApp must be properly created before other resources can start being processed. It's more material to look into, with plenty of hot spots that can be the cause of this issue. We are looking into it
Any update on this?
We are facing the exact same issue on vCD version 10.3.3.19610595
Happening after attaching 2 vcd_vapp_org_network
inside a for_each
terraform loop.
FYI
This issue wasn't there on version 9.7.0
(9.7.0.14534864 )
Hello, I was monitoring https://github.com/hashicorp/terraform-plugin-sdk/issues/67 for a workaround. Idea was I could set a parallism of 1 for resources, that modifies the vAPP (vcd_vapp_access_control , vcd_vapp_org_network)
They mentioned a solution, but it has to be implemented in the provider, not in terraform core: https://github.com/hashicorp/terraform-plugin-sdk/issues/67#issuecomment-1170071965
But I'm sure you are already aware of this?
Terraform Version
Terraform v0.13.5
Affected Resource(s)
Terraform Configuration Files
Debug Output
I have added some debug lines into the provider in
resource_vcd_vapp.go
:Terraform Trace Output without
guest_properties
set:Terraform Trace Output with
guest_properties
set:Expected Behavior
Terraform always should wait until vApp creation is completed.
Actual Behavior
In some cases the next steps depending on successfully created vApp start although the vApp creation is not completed and end in errors like this because Terraform does not wait for completion if optional
guest_properties
are not set:Steps to Reproduce
Please list the steps required to reproduce the issue, for example:
terraform apply
guest_properties
section to the configurationterraform destroy
terraform apply
Possible solution
Move the "wait" block out of the if-condition for
guest_properties
here: https://github.com/vmware/terraform-provider-vcd/blob/75876b5986d45908a78c1c2acfde29a48c82618a/vcd/resource_vcd_vapp.go#L118