Skip to content

Commit 614fe4a

Browse files
committed
Added hostid parameter for deploying virtual machine
1 parent a19b4ae commit 614fe4a

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

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,
@@ -297,6 +302,12 @@ func resourceCloudStackInstanceCreate(d *schema.ResourceData, meta interface{})
297302
p.SetKeypair(keypair.(string))
298303
}
299304

305+
// If a hostid is supplied, add it to the parameter struct
306+
307+
if hostid, ok := d.GetOk("hostid"); ok {
308+
p.SetHostid(hostid.(string))
309+
}
310+
300311
if userData, ok := d.GetOk("user_data"); ok {
301312
ud, err := getUserData(userData.(string), cs.HTTPGETOnly)
302313
if err != nil {

0 commit comments

Comments
 (0)