Skip to content

Commit 34ffb9a

Browse files
authored
added cluster_id parameter and modified hostid to host_id (#79)
1 parent ea87939 commit 34ffb9a

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

cloudstack/resource_cloudstack_instance.go

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

147-
"hostid": {
147+
"host_id": {
148+
Type: schema.TypeString,
149+
Optional: true,
150+
},
151+
152+
"cluster_id": {
148153
Type: schema.TypeString,
149154
Optional: true,
150155
},
@@ -333,12 +338,18 @@ func resourceCloudStackInstanceCreate(d *schema.ResourceData, meta interface{})
333338
p.SetKeypair(keypair.(string))
334339
}
335340

336-
// If a hostid is supplied, add it to the parameter struct
341+
// If a host_id is supplied, add it to the parameter struct
337342

338-
if hostid, ok := d.GetOk("hostid"); ok {
343+
if hostid, ok := d.GetOk("host_id"); ok {
339344
p.SetHostid(hostid.(string))
340345
}
341346

347+
// If a cluster_id is supplied, add it to the parameter struct
348+
349+
if clusterid, ok := d.GetOk("cluster_id"); ok {
350+
p.SetClusterid(clusterid.(string))
351+
}
352+
342353
if userData, ok := d.GetOk("user_data"); ok {
343354
ud, err := getUserData(userData.(string), cs.HTTPGETOnly)
344355
if err != nil {

website/docs/r/instance.html.markdown

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ The following arguments are supported:
3434
* `service_offering` - (Required) The name or ID of the service offering used
3535
for this instance.
3636

37+
* `host_id` - (Optional) destination Host ID to deploy the VM to - parameter available
38+
for root admin only
39+
40+
* `cluster_id` - (Optional) destination Cluster ID to deploy the VM to - parameter available
41+
for root admin only
42+
3743
* `network_id` - (Optional) The ID of the network to connect this instance
3844
to. Changing this forces a new resource to be created.
3945

0 commit comments

Comments
 (0)