Skip to content

Commit

Permalink
Move kubernetes config check out of providerConfigure (#648)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrhouston authored Dec 19, 2020
1 parent b01dc82 commit 9de5e32
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions helm/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,16 +268,12 @@ func checkKubernetesConfigurationValid(d *schema.ResourceData) error {
return fmt.Errorf(`provider not configured: you must configure a path to your kubeconfig
or explicitly supply credentials via the provider block or environment variables.
See our documentation at: %s`, authDocumentationURL)
See our authentication documentation at: %s`, authDocumentationURL)
}

func providerConfigure(d *schema.ResourceData, terraformVersion string) (interface{}, diag.Diagnostics) {
m := &Meta{data: d}

if err := checkKubernetesConfigurationValid(d); err != nil {
return nil, diag.FromErr(err)
}

settings := cli.New()
settings.Debug = d.Get("debug").(bool)

Expand Down Expand Up @@ -360,6 +356,10 @@ func (m *Meta) GetHelmConfiguration(namespace string) (*action.Configuration, er
debug("[INFO] GetHelmConfiguration start")
actionConfig := new(action.Configuration)

if err := checkKubernetesConfigurationValid(m.data); err != nil {
return nil, err
}

kc, err := newKubeConfig(m.data, &namespace)
if err != nil {
return nil, err
Expand Down

0 comments on commit 9de5e32

Please sign in to comment.