This is an automated email from the ASF dual-hosted git repository.
sureshanaparti 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 847cfe5 Fix userdata details being improperly serialized (#295)
847cfe5 is described below
commit 847cfe516457d0034fb3747c254b0f0387379919
Author: bddvlpr <[email protected]>
AuthorDate: Mon Aug 17 12:59:44 2026 +0200
Fix userdata details being improperly serialized (#295)
---
cloudstack/resource_cloudstack_instance.go | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/cloudstack/resource_cloudstack_instance.go
b/cloudstack/resource_cloudstack_instance.go
index 933f163..dcc750f 100644
--- a/cloudstack/resource_cloudstack_instance.go
+++ b/cloudstack/resource_cloudstack_instance.go
@@ -475,13 +475,11 @@ func resourceCloudStackInstanceCreate(d
*schema.ResourceData, meta interface{})
}
if userdataDetails, ok := d.GetOk("userdata_details"); ok {
- udDetails := make(map[string]string)
- index := 0
+ ud := make(map[string]string)
for k, v := range userdataDetails.(map[string]interface{}) {
- udDetails[fmt.Sprintf("userdatadetails[%d].%s", index,
k)] = v.(string)
- index++
+ ud[k] = v.(string)
}
- p.SetUserdatadetails(udDetails)
+ p.SetUserdatadetails(ud)
}
// Create the new instance
@@ -850,13 +848,11 @@ func resourceCloudStackInstanceUpdate(d
*schema.ResourceData, meta interface{})
p :=
cs.VirtualMachine.NewUpdateVirtualMachineParams(d.Id())
if userdataDetails, ok := d.GetOk("userdata_details");
ok {
- udDetails := make(map[string]string)
- index := 0
+ ud := make(map[string]string)
for k, v := range
userdataDetails.(map[string]interface{}) {
-
udDetails[fmt.Sprintf("userdatadetails[%d].%s", index, k)] = v.(string)
- index++
+ ud[k] = v.(string)
}
- p.SetUserdatadetails(udDetails)
+ p.SetUserdatadetails(ud)
}
_, err := cs.VirtualMachine.UpdateVirtualMachine(p)
if err != nil {