Skip to content

Commit da40315

Browse files
committed
fix: datasource kubernetes_cluster_authentication_options output
1 parent f66f386 commit da40315

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

tencentcloud/services/tke/data_source_tc_kubernetes_cluster_authentication_options_extension.go

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import (
44
"context"
55
"fmt"
66

7+
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
8+
79
tccommon "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/common"
810
)
911

@@ -17,12 +19,23 @@ func dataSourceTencentCloudKubernetesClusterAuthenticationOptionsReadOutputConte
1719

1820
if v, ok := d.GetOk("service_accounts"); ok {
1921
if vList, isList := v.([]interface{}); isList && len(vList) > 0 {
20-
tmpList = append(tmpList, vList[0].(map[string]interface{}))
22+
if vList[0] == nil {
23+
tmpList = append(tmpList, map[string]interface{}{})
24+
} else {
25+
tmpList = append(tmpList, vList[0].(map[string]interface{}))
26+
}
2127
}
2228
}
2329
if v, ok := d.GetOk("oidc_config"); ok {
2430
if vList, isList := v.([]interface{}); isList && len(vList) > 0 {
25-
tmpList = append(tmpList, vList[0].(map[string]interface{}))
31+
if vList[0] == nil {
32+
tmpList = append(tmpList, map[string]interface{}{})
33+
} else {
34+
vMap := vList[0].(map[string]interface{})
35+
autoCreateClientID, _ := vMap["auto_create_client_id"].(*schema.Set)
36+
vMap["auto_create_client_id"] = autoCreateClientID.List()
37+
tmpList = append(tmpList, vMap)
38+
}
2639
}
2740
}
2841

0 commit comments

Comments
 (0)