@@ -212,10 +212,6 @@ func (k kubeClientsets) MainClientset() (*kubernetes.Clientset, error) {
212212 return k .mainClientset , nil
213213 }
214214
215- if err := checkConfigurationValid (k .configData ); err != nil {
216- return nil , err
217- }
218-
219215 if k .config != nil {
220216 kc , err := kubernetes .NewForConfig (k .config )
221217 if err != nil {
@@ -240,52 +236,6 @@ func (k kubeClientsets) AggregatorClientset() (*aggregator.Clientset, error) {
240236 return k .aggregatorClientset , nil
241237}
242238
243- var apiTokenMountPath = "/var/run/secrets/kubernetes.io/serviceaccount"
244-
245- func inCluster () bool {
246- host , port := os .Getenv ("KUBERNETES_SERVICE_HOST" ), os .Getenv ("KUBERNETES_SERVICE_PORT" )
247- if host == "" || port == "" {
248- return false
249- }
250-
251- if _ , err := os .Stat (apiTokenMountPath ); err != nil {
252- return false
253- }
254- return true
255- }
256-
257- var authDocumentationURL = "https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs#authentication"
258-
259- func checkConfigurationValid (d * schema.ResourceData ) error {
260- if inCluster () {
261- log .Printf ("[DEBUG] Terraform appears to be running inside the Kubernetes cluster" )
262- return nil
263- }
264-
265- if os .Getenv ("KUBE_CONFIG_PATHS" ) != "" {
266- return nil
267- }
268-
269- atLeastOneOf := []string {
270- "host" ,
271- "config_path" ,
272- "config_paths" ,
273- "client_certificate" ,
274- "token" ,
275- "exec" ,
276- }
277- for _ , a := range atLeastOneOf {
278- if _ , ok := d .GetOk (a ); ok {
279- return nil
280- }
281- }
282-
283- return fmt .Errorf (`provider not configured: you must configure a path to your kubeconfig
284- or explicitly supply credentials via the provider block or environment variables.
285-
286- See our documentation at: %s` , authDocumentationURL )
287- }
288-
289239func providerConfigure (ctx context.Context , d * schema.ResourceData , terraformVersion string ) (interface {}, diag.Diagnostics ) {
290240 // Config initialization
291241 cfg , err := initializeConfiguration (d )
0 commit comments