nagaboinaramgopal opened a new pull request, #346:
URL: https://github.com/apache/cloudstack-terraform-provider/pull/346
### Description
The disk update detects a change of the attached VM to trigger a detach and
re-attach, but it checked `d.HasChange("virtual_machine")`, and the schema key
is `virtual_machine_id`. `HasChange` on a key that does not exist is always
false, so changing `virtual_machine_id` never ran the detach branch and the
volume was re-attached to the new VM without being detached from the old one.
Fixed to check `virtual_machine_id`.
### Testing
Added a unit test `TestDiskUpdateDetachesWhenVirtualMachineChanges` that
runs an update with `virtual_machine_id` changed and asserts the returned error
comes from the detach path. It needs no live CloudStack:
go test ./cloudstack/ -run
TestDiskUpdateDetachesWhenVirtualMachineChanges
Before the fix the update skips the detach and the error comes from the
attach path instead, so the test fails.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]