Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions cloudstack/resource_cloudstack_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,12 @@ func resourceCloudStackInstance() *schema.Resource {
Optional: true,
},

"hostid": {
"host_id": {
Comment thread
sureshanaparti marked this conversation as resolved.
Type: schema.TypeString,
Optional: true,
},

"cluster_id": {
Type: schema.TypeString,
Optional: true,
},
Expand Down Expand Up @@ -333,12 +338,18 @@ func resourceCloudStackInstanceCreate(d *schema.ResourceData, meta interface{})
p.SetKeypair(keypair.(string))
}

// If a hostid is supplied, add it to the parameter struct
// If a host_id is supplied, add it to the parameter struct

if hostid, ok := d.GetOk("hostid"); ok {
if hostid, ok := d.GetOk("host_id"); ok {
p.SetHostid(hostid.(string))
}

// If a cluster_id is supplied, add it to the parameter struct

if clusterid, ok := d.GetOk("cluster_id"); ok {
p.SetClusterid(clusterid.(string))
}

if userData, ok := d.GetOk("user_data"); ok {
ud, err := getUserData(userData.(string), cs.HTTPGETOnly)
if err != nil {
Expand Down
6 changes: 6 additions & 0 deletions website/docs/r/instance.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ The following arguments are supported:
* `service_offering` - (Required) The name or ID of the service offering used
for this instance.

* `host_id` - (Optional) destination Host ID to deploy the VM to - parameter available
for root admin only

* `cluster_id` - (Optional) destination Cluster ID to deploy the VM to - parameter available
for root admin only

* `network_id` - (Optional) The ID of the network to connect this instance
to. Changing this forces a new resource to be created.

Expand Down