diff --git a/cloudstack/resource_cloudstack_instance.go b/cloudstack/resource_cloudstack_instance.go index f9f8d871..0c1a6bb1 100644 --- a/cloudstack/resource_cloudstack_instance.go +++ b/cloudstack/resource_cloudstack_instance.go @@ -144,7 +144,12 @@ func resourceCloudStackInstance() *schema.Resource { Optional: true, }, - "hostid": { + "host_id": { + Type: schema.TypeString, + Optional: true, + }, + + "cluster_id": { Type: schema.TypeString, Optional: true, }, @@ -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 { diff --git a/website/docs/r/instance.html.markdown b/website/docs/r/instance.html.markdown index 018b5b03..b5021cc1 100644 --- a/website/docs/r/instance.html.markdown +++ b/website/docs/r/instance.html.markdown @@ -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.