Rancher: error when no api_url is provided (#13086)
This commit is contained in:
parent
ea71adbea9
commit
ba0f80275f
|
@ -2,6 +2,7 @@ package rancher
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
|
@ -87,7 +88,7 @@ func providerConfigure(d *schema.ResourceData) (interface{}, error) {
|
||||||
return config, err
|
return config, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if apiURL == "" {
|
if apiURL == "" && config.URL != "" {
|
||||||
u, err := url.Parse(config.URL)
|
u, err := url.Parse(config.URL)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return config, err
|
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{
|
config := &Config{
|
||||||
APIURL: apiURL + "/v1",
|
APIURL: apiURL + "/v1",
|
||||||
AccessKey: accessKey,
|
AccessKey: accessKey,
|
||||||
|
|
Loading…
Reference in New Issue