-
Notifications
You must be signed in to change notification settings - Fork 112
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 reboot_vapp_on_removal flag to vcd_vapp_network and vcd_vapp_org_network #1004
Conversation
…network Signed-off-by: Dainius Serplis <dserplis@vmware.com>
Signed-off-by: Dainius Serplis <dserplis@vmware.com>
Signed-off-by: Dainius Serplis <dserplis@vmware.com>
Signed-off-by: Dainius Serplis <dserplis@vmware.com>
Signed-off-by: Dainius Serplis <dserplis@vmware.com>
Signed-off-by: Dainius Serplis <dserplis@vmware.com>
Signed-off-by: Dainius Serplis <dserplis@vmware.com>
Signed-off-by: Dainius Serplis <dserplis@vmware.com>
Signed-off-by: Dainius Serplis <dserplis@vmware.com>
Signed-off-by: Dainius Serplis <dserplis@vmware.com>
Signed-off-by: Dainius Serplis <dserplis@vmware.com>
Signed-off-by: Dainius Serplis <dserplis@vmware.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for amendments!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great improvement, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the improvement!
Signed-off-by: Dainius Serplis <dserplis@vmware.com>
Signed-off-by: Dainius Serplis <dserplis@vmware.com>
Closes #989
This PR adds new
reboot_vapp_on_removal
flag (false by default) tovcd_vapp_network
andvcd_vapp_org_network
resources.Problem
It was never possible to delete a vApp network from a running vApp in UI, however, VCD API did not enforce this rule up to VCD version 10.4.1 and Terraform users were actually able to remove vApp networks from powered on vApps. In VCD 10.4.1, API started validating this error and Terraform is no longer capable of removing it.
Using Terraform became inconvenient and a very common case is hitting an error during
terraform destroy
operation (sample HCL snippet at the bottom). The error itself looks the following:Error: error removing vApp network: detaching vApp network MY-NETWORK-NAME (id '9bdad09b-0d6f-4fd6-94cc-3149c6cb7996'): API Error: 409: [ b260b5d9-7716-413d-8b7f-55a2d4356d6c ] The requested operation could not be executed on vApp "7a37828a-cfa5-487a-bcaf-6e5e9d616b03". Stop the vApp and try again.
Solution
A new flag
reboot_vapp_on_removal
invcd_vapp_network
andvcd_vapp_org_network
resources is introduced to signal that a parent vApp can be powered off (if not already powered off) during vApp network removal. After vApp network removal it will power on the vApp again (unless it was already powered off before the operation). This functionality should help not only indestroy
scenarios but also in some other cases where vApp power off is not critical.Note. The flag is effective only in
destroy
(delete) operations. Enabling the flag would cause diff to be reported, but the update operation will do nothing if only the value ofreboot_vapp_on_removal
has changed.After this PR, an attempt to remove vApp network on VCD 10.4.1 without
reboot_vapp_on_removal=true
would result in such a message to a user:Additional changes
vcd_vapp_network
andvcd_vapp_org_network
had identicaldelete
functions. This PR adds additional complexity todelete
functions and there is a risk of having them out of sync with future PRs. Both resources now use the same function and we can split them in future if it is needed.Snippet to replicate error