@@ -367,36 +367,33 @@ func flattenServiceEndpointKubernetes(d *schema.ResourceData, serviceEndpoint *s
367
367
d .Set ("azure_subscription" , configItemList )
368
368
case "Kubeconfig" :
369
369
var kubeconfig map [string ]interface {}
370
- kubeconfigSet := d .Get ("kubeconfig" ).([]interface {})
371
- configuration := kubeconfigSet [0 ].(map [string ]interface {})
372
370
373
- if len (configuration ) > 0 {
374
- kubeconfig = map [string ]interface {}{}
371
+ kubeconfig = map [string ]interface {}{}
375
372
376
- if v , ok := configuration ["kube_config" ]; ok {
373
+ if kubeconfigSet := d .Get ("kubeconfig" ).([]interface {}); len (kubeconfigSet ) != 0 {
374
+ if v , ok := kubeconfigSet [0 ].(map [string ]interface {})["kube_config" ]; ok {
377
375
kubeconfig ["kube_config" ] = v .(string )
378
376
}
377
+ }
379
378
380
- if serviceEndpoint .Data != nil {
381
- if v , ok := (* serviceEndpoint .Data )["acceptUntrustedCerts" ]; ok {
382
- acceptUntrustedCerts , err := strconv .ParseBool (v )
383
- if err != nil {
384
- return fmt .Errorf ("failed to parse `accept_untrusted_certs`: %+v " , err )
385
- }
386
- kubeconfig ["accept_untrusted_certs" ] = acceptUntrustedCerts
379
+ if serviceEndpoint .Data != nil {
380
+ if v , ok := (* serviceEndpoint .Data )["acceptUntrustedCerts" ]; ok {
381
+ acceptUntrustedCerts , err := strconv .ParseBool (v )
382
+ if err != nil {
383
+ return fmt .Errorf ("failed to parse `accept_untrusted_certs`: %+v " , err )
387
384
}
385
+ kubeconfig ["accept_untrusted_certs" ] = acceptUntrustedCerts
388
386
}
387
+ }
389
388
390
- if serviceEndpoint .Authorization != nil && serviceEndpoint .Authorization .Parameters != nil {
391
- if v , ok := (* serviceEndpoint .Authorization .Parameters )["clusterContext" ]; ok {
392
- kubeconfig ["cluster_context" ] = v
393
- }
389
+ if serviceEndpoint .Authorization != nil && serviceEndpoint .Authorization .Parameters != nil {
390
+ if v , ok := (* serviceEndpoint .Authorization .Parameters )["clusterContext" ]; ok {
391
+ kubeconfig ["cluster_context" ] = v
394
392
}
395
-
396
- kubeconfigList := make ([]map [string ]interface {}, 1 )
397
- kubeconfigList [0 ] = kubeconfig
398
- d .Set ("kubeconfig" , kubeconfigList )
399
393
}
394
+ kubeconfigList := make ([]map [string ]interface {}, 1 )
395
+ kubeconfigList [0 ] = kubeconfig
396
+ d .Set ("kubeconfig" , kubeconfigList )
400
397
case "ServiceAccount" :
401
398
var serviceAccount map [string ]interface {}
402
399
serviceAccountSet := d .Get ("service_account" ).([]interface {})
0 commit comments