@@ -79,20 +79,23 @@ func Provider() *schema.Provider {
79
79
if raw != "" {
80
80
config , err = getClientConfig ([]byte (raw ), context )
81
81
if err != nil {
82
- config = & rest. Config {}
82
+ return nil , fmt . Errorf ( "provider kustomization: kubeconfig_raw: %s" , err )
83
83
}
84
84
}
85
85
86
86
if raw == "" && path != "" {
87
87
data , _ = readKubeconfigFile (path )
88
88
config , err = getClientConfig (data , context )
89
89
if err != nil {
90
- config = & rest. Config {}
90
+ return nil , fmt . Errorf ( "provider kustomization: kubeconfig_path: %s" , err )
91
91
}
92
92
}
93
93
94
+ // empty default config required to support
95
+ // using a cluster resource or data source
96
+ // that may not exist yet, to configure the provider
94
97
if config == nil {
95
- return nil , fmt . Errorf ( "provider kustomization: no configuration: `kubeconfig_path` or `kubeconfig_raw` required" )
98
+ config = & rest. Config {}
96
99
}
97
100
98
101
// Increase QPS and Burst rate limits
@@ -101,12 +104,12 @@ func Provider() *schema.Provider {
101
104
102
105
client , err := dynamic .NewForConfig (config )
103
106
if err != nil {
104
- return nil , err
107
+ return nil , fmt . Errorf ( "provider kustomization: %s" , err )
105
108
}
106
109
107
110
clientset , err := kubernetes .NewForConfig (config )
108
111
if err != nil {
109
- return nil , err
112
+ return nil , fmt . Errorf ( "provider kustomization: %s" , err )
110
113
}
111
114
112
115
cgvk := newCachedGroupVersionKind (clientset )
0 commit comments