Skip to content

Commit 854b74a

Browse files
committed
fix delete auth_option npe
1 parent da9b644 commit 854b74a

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

tencentcloud/resource_tc_kubernetes_cluster.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1547,18 +1547,20 @@ func tkeGetAuthOptions(d *schema.ResourceData) *tke.ModifyClusterAuthenticationO
15471547
raw, ok := d.GetOk("auth_options")
15481548
options := raw.([]interface{})
15491549

1550-
if !ok || len(options) == 0 {
1551-
return nil
1552-
}
1553-
1554-
option := options[0].(map[string]interface{})
15551550
request := tke.NewModifyClusterAuthenticationOptionsRequest()
15561551
request.ClusterId = helper.String(d.Id())
1557-
15581552
request.ServiceAccounts = &tke.ServiceAccountAuthenticationOptions{
15591553
AutoCreateDiscoveryAnonymousAuth: helper.Bool(false),
1554+
Issuer: helper.String(""),
1555+
JWKSURI: helper.String(""),
15601556
}
15611557

1558+
if !ok || len(options) == 0 {
1559+
return request
1560+
}
1561+
1562+
option := options[0].(map[string]interface{})
1563+
15621564
if v, ok := option["auto_create_discovery_anonymous_auth"]; ok {
15631565
request.ServiceAccounts.AutoCreateDiscoveryAnonymousAuth = helper.Bool(v.(bool))
15641566
}

0 commit comments

Comments
 (0)