Skip to content

Commit 8dd95a2

Browse files
authored
Add support to provide VM details during VM deployment - when using custom offering (#7)
1 parent e7a1160 commit 8dd95a2

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

cloudstack/resource_cloudstack_instance.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,11 @@ func resourceCloudStackInstance() *schema.Resource {
165165
},
166166
},
167167

168+
"details": {
169+
Type: schema.TypeMap,
170+
Optional: true,
171+
},
172+
168173
"expunge": {
169174
Type: schema.TypeBool,
170175
Optional: true,
@@ -206,7 +211,13 @@ func resourceCloudStackInstanceCreate(d *schema.ResourceData, meta interface{})
206211
// Create a new parameter struct
207212
p := cs.VirtualMachine.NewDeployVirtualMachineParams(serviceofferingid, templateid, zone.Id)
208213
p.SetStartvm(d.Get("start_vm").(bool))
209-
214+
vmDetails := make(map[string]string)
215+
if details, ok := d.GetOk("details"); ok {
216+
for k, v := range details.(map[string]interface{}) {
217+
vmDetails[k] = v.(string)
218+
}
219+
p.SetDetails(vmDetails)
220+
}
210221
// Set the name
211222
name, hasName := d.GetOk("name")
212223
if hasName {

0 commit comments

Comments
 (0)