Skip to content

Commit

Permalink
return error if could not create client
Browse files Browse the repository at this point in the history
  • Loading branch information
maciaszczykm committed Dec 6, 2023
1 parent 3c07fbf commit 4e77932
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions internal/resource/cluster_kubeconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,11 @@ func newKubeconfig(ctx context.Context, kubeconfig *Kubeconfig, namespace *strin

client := clientcmd.NewNonInteractiveDeferredLoadingClientConfig(loader, overrides)
if client == nil {
tflog.Error(ctx, "failed to initialize kubernetes config")
return nil, nil
err := fmt.Errorf("failed to initialize kubernetes config")
tflog.Error(ctx, err.Error())
return nil, err
}
tflog.Trace(ctx, "successfully initialized kubernetes config")

tflog.Trace(ctx, "successfully initialized kubernetes config")
return &KubeConfig{ClientConfig: client}, nil
}

0 comments on commit 4e77932

Please sign in to comment.