diff --git a/cloudstack/resource_cloudstack_instance.go b/cloudstack/resource_cloudstack_instance.go index fdf77ee9..8b188eb7 100644 --- a/cloudstack/resource_cloudstack_instance.go +++ b/cloudstack/resource_cloudstack_instance.go @@ -64,6 +64,14 @@ func resourceCloudStackInstance() *schema.Resource { Optional: true, Computed: true, ForceNew: true, + ConflictsWith: []string{"network_ids"}, + }, + + "network_ids": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{Type: schema.TypeString}, + ConflictsWith: []string{"network_id"}, }, "ip_address": { @@ -307,6 +315,14 @@ func resourceCloudStackInstanceCreate(d *schema.ResourceData, meta interface{}) p.SetNetworkids([]string{d.Get("network_id").(string)}) } + if networks, ok := d.GetOk("network_ids"); ok { + var networkIds []string + for _, nw := range networks.([]interface{}) { + networkIds = append(networkIds, fmt.Sprintf("%v", nw)) + } + p.SetNetworkids(networkIds); + } + // If there is a ipaddres supplied, add it to the parameter struct if ipaddress, ok := d.GetOk("ip_address"); ok { p.SetIpaddress(ipaddress.(string))