Rancher: error when no api_url is provided (#13086)

This commit is contained in:
Raphaël Pinson 2017-03-28 11:18:03 +02:00 committed by Paul Stack
parent ea71adbea9
commit ba0f80275f
1 changed files with 6 additions and 1 deletions

View File

@ -2,6 +2,7 @@ package rancher
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/url"
"os"
@ -87,7 +88,7 @@ func providerConfigure(d *schema.ResourceData) (interface{}, error) {
return config, err
}
if apiURL == "" {
if apiURL == "" && config.URL != "" {
u, err := url.Parse(config.URL)
if err != nil {
return config, err
@ -104,6 +105,10 @@ func providerConfigure(d *schema.ResourceData) (interface{}, error) {
}
}
if apiURL == "" {
return &Config{}, fmt.Errorf("No api_url provided")
}
config := &Config{
APIURL: apiURL + "/v1",
AccessKey: accessKey,