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 (
|
||||
"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,
|
||||
|
|
Loading…
Reference in New Issue