Skip to content

Commit ca8d5d9

Browse files
authored
Added hostid parameter for deploying virtual machine (#52)
1 parent 7f7d1ec commit ca8d5d9

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

cloudstack/resource_cloudstack_instance.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,11 @@ func resourceCloudStackInstance() *schema.Resource {
144144
Optional: true,
145145
},
146146

147+
"hostid": {
148+
Type: schema.TypeString,
149+
Optional: true,
150+
},
151+
147152
"start_vm": {
148153
Type: schema.TypeBool,
149154
Optional: true,
@@ -328,6 +333,12 @@ func resourceCloudStackInstanceCreate(d *schema.ResourceData, meta interface{})
328333
p.SetKeypair(keypair.(string))
329334
}
330335

336+
// If a hostid is supplied, add it to the parameter struct
337+
338+
if hostid, ok := d.GetOk("hostid"); ok {
339+
p.SetHostid(hostid.(string))
340+
}
341+
331342
if userData, ok := d.GetOk("user_data"); ok {
332343
ud, err := getUserData(userData.(string), cs.HTTPGETOnly)
333344
if err != nil {

0 commit comments

Comments
 (0)