This is an automated email from the ASF dual-hosted git repository.
rohit pushed a commit to branch main
in repository
https://gitbox.apache.org/repos/asf/cloudstack-terraform-provider.git
The following commit(s) were added to refs/heads/main by this push:
new 5be794b Update details if changed for an instance (#91)
5be794b is described below
commit 5be794b8e05e58521b5c7096bc0604eb107157e1
Author: Vishesh <[email protected]>
AuthorDate: Wed Mar 6 10:42:38 2024 +0530
Update details if changed for an instance (#91)
---
cloudstack/resource_cloudstack_instance.go | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/cloudstack/resource_cloudstack_instance.go
b/cloudstack/resource_cloudstack_instance.go
index 03aaf59..aae2408 100644
--- a/cloudstack/resource_cloudstack_instance.go
+++ b/cloudstack/resource_cloudstack_instance.go
@@ -677,7 +677,7 @@ func resourceCloudStackInstanceUpdate(d
*schema.ResourceData, meta interface{})
}
}
- // Check is the tags have changed and if so, update the tags
+ // Check if the tags have changed and if so, update the tags
if d.HasChange("tags") {
if err := updateTags(cs, d, "UserVm"); err != nil {
return fmt.Errorf("Error updating tags on instance %s:
%s", name, err)
@@ -685,6 +685,18 @@ func resourceCloudStackInstanceUpdate(d
*schema.ResourceData, meta interface{})
d.SetPartial("tags")
}
+ // Check if the details have changed and if so, update the details
+ if d.HasChange("details") {
+ p := cs.VirtualMachine.NewUpdateVirtualMachineParams(d.Id())
+ vmDetails := make(map[string]string)
+ if details := d.Get("details"); details != nil {
+ for k, v := range details.(map[string]interface{}) {
+ vmDetails[k] = v.(string)
+ }
+ }
+ p.SetDetails(vmDetails)
+ }
+
d.Partial(false)
return resourceCloudStackInstanceRead(d, meta)