Skip to content

Commit 8aae7c2

Browse files
xaweiandyxawei
andauthored
fix: change para issuer in tke auth attachment from required to optional (#1667)
* fix: change para issuer in tke auth attachment from required to optional * misc: add change log --------- Co-authored-by: andyxawei <andyxawei@tencent.com>
1 parent a05f78e commit 8aae7c2

File tree

5 files changed

+23
-18
lines changed

5 files changed

+23
-18
lines changed

.changelog/1667.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
```release-note:enhancement
2+
resource/tencentcloud_kubernetes_cluster: update document
3+
```
4+
```release-note:enhancement
5+
resource/tencentcloud_kubernetes_auth_attachment: change para issuer in tke auth attachment from required to optional
6+
```

tencentcloud/resource_tc_kubernetes_auth_attachment.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ resource "tencentcloud_kubernetes_cluster" "managed_cluster" {
132132
# if you want to use tke default issuer and jwks_uri, please set use_tke_default to true and set issuer to empty string.
133133
resource "tencentcloud_kubernetes_auth_attachment" "test_use_tke_default_auth_attach" {
134134
cluster_id = tencentcloud_kubernetes_cluster.managed_cluster.id
135-
issuer = ""
136135
auto_create_discovery_anonymous_auth = true
137136
use_tke_default = true
138137
}
@@ -160,18 +159,18 @@ func resourceTencentCloudTKEAuthAttachment() *schema.Resource {
160159
},
161160
"issuer": {
162161
Type: schema.TypeString,
163-
Required: true,
164-
Description: "Specify service-account-issuer. If use_tke_default is set to `true`, please set this parameter value to empty string.",
162+
Optional: true,
163+
Description: "Specify service-account-issuer. If use_tke_default is set to `true`, please do not set this field.",
165164
},
166165
"use_tke_default": {
167166
Type: schema.TypeBool,
168167
Optional: true,
169-
Description: "If set to `true`, the issuer and jwks_uri will be generated automatically by tke, please use empty string as value of issuer and jwks_uri.",
168+
Description: "If set to `true`, the issuer and jwks_uri will be generated automatically by tke, please do not set issuer and jwks_uri.",
170169
},
171170
"jwks_uri": {
172171
Type: schema.TypeString,
173172
Optional: true,
174-
Description: "Specify service-account-jwks-uri. If use_tke_default is set to `true`, please set this parameter value to empty string or just ignore it.",
173+
Description: "Specify service-account-jwks-uri. If use_tke_default is set to `true`, please do not set this field.",
175174
},
176175
"auto_create_discovery_anonymous_auth": {
177176
Type: schema.TypeBool,
@@ -206,9 +205,7 @@ func resourceTencentCloudTKEAuthAttachmentCreate(d *schema.ResourceData, meta in
206205
service := TkeService{client: meta.(*TencentCloudClient).apiV3Conn}
207206
request := tke.NewModifyClusterAuthenticationOptionsRequest()
208207
request.ClusterId = &id
209-
request.ServiceAccounts = &tke.ServiceAccountAuthenticationOptions{
210-
Issuer: helper.String(d.Get("issuer").(string)),
211-
}
208+
request.ServiceAccounts = &tke.ServiceAccountAuthenticationOptions{}
212209

213210
if v, ok := d.GetOk("auto_create_discovery_anonymous_auth"); ok {
214211
request.ServiceAccounts.AutoCreateDiscoveryAnonymousAuth = helper.Bool(v.(bool))
@@ -217,6 +214,9 @@ func resourceTencentCloudTKEAuthAttachmentCreate(d *schema.ResourceData, meta in
217214
if v, ok := d.GetOk("use_tke_default"); ok && v.(bool) {
218215
request.ServiceAccounts.UseTKEDefault = helper.Bool(true)
219216
} else {
217+
if v, ok := d.GetOk("issuer"); ok {
218+
request.ServiceAccounts.Issuer = helper.String(v.(string))
219+
}
220220
if v, ok := d.GetOk("jwks_uri"); ok {
221221
request.ServiceAccounts.JWKSURI = helper.String(v.(string))
222222
}

tencentcloud/resource_tc_kubernetes_cluster.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,17 +1281,17 @@ func resourceTencentCloudTkeCluster() *schema.Resource {
12811281
"use_tke_default": {
12821282
Type: schema.TypeBool,
12831283
Optional: true,
1284-
Description: "If set to `true`, the issuer and jwks_uri will be generated automatically by tke, please use empty string as value of issuer and jwks_uri.",
1284+
Description: "If set to `true`, the issuer and jwks_uri will be generated automatically by tke, please do not set issuer and jwks_uri, and they will be ignored.",
12851285
},
12861286
"jwks_uri": {
12871287
Type: schema.TypeString,
12881288
Optional: true,
1289-
Description: "Specify service-account-jwks-uri. If use_tke_default is set to `true`, please set this parameter value to empty string or just ignore it.",
1289+
Description: "Specify service-account-jwks-uri. If use_tke_default is set to `true`, please do not set this field, it will be ignored anyway.",
12901290
},
12911291
"issuer": {
12921292
Type: schema.TypeString,
12931293
Optional: true,
1294-
Description: "Specify service-account-issuer. If use_tke_default is set to `true`, please set this parameter value to empty string or just ignore it.",
1294+
Description: "Specify service-account-issuer. If use_tke_default is set to `true`, please do not set this field, it will be ignored anyway.",
12951295
},
12961296
"auto_create_discovery_anonymous_auth": {
12971297
Type: schema.TypeBool,

website/docs/r/kubernetes_auth_attachment.html.markdown

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ resource "tencentcloud_kubernetes_cluster" "managed_cluster" {
142142
# if you want to use tke default issuer and jwks_uri, please set use_tke_default to true and set issuer to empty string.
143143
resource "tencentcloud_kubernetes_auth_attachment" "test_use_tke_default_auth_attach" {
144144
cluster_id = tencentcloud_kubernetes_cluster.managed_cluster.id
145-
issuer = ""
146145
auto_create_discovery_anonymous_auth = true
147146
use_tke_default = true
148147
}
@@ -153,10 +152,10 @@ resource "tencentcloud_kubernetes_auth_attachment" "test_use_tke_default_auth_at
153152
The following arguments are supported:
154153

155154
* `cluster_id` - (Required, String) ID of clusters.
156-
* `issuer` - (Required, String) Specify service-account-issuer. If use_tke_default is set to `true`, please set this parameter value to empty string.
157155
* `auto_create_discovery_anonymous_auth` - (Optional, Bool) If set to `true`, the rbac rule will be created automatically which allow anonymous user to access '/.well-known/openid-configuration' and '/openid/v1/jwks'.
158-
* `jwks_uri` - (Optional, String) Specify service-account-jwks-uri. If use_tke_default is set to `true`, please set this parameter value to empty string or just ignore it.
159-
* `use_tke_default` - (Optional, Bool) If set to `true`, the issuer and jwks_uri will be generated automatically by tke, please use empty string as value of issuer and jwks_uri.
156+
* `issuer` - (Optional, String) Specify service-account-issuer. If use_tke_default is set to `true`, please do not set this field.
157+
* `jwks_uri` - (Optional, String) Specify service-account-jwks-uri. If use_tke_default is set to `true`, please do not set this field.
158+
* `use_tke_default` - (Optional, Bool) If set to `true`, the issuer and jwks_uri will be generated automatically by tke, please do not set issuer and jwks_uri.
160159

161160
## Attributes Reference
162161

website/docs/r/kubernetes_cluster.html.markdown

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -512,9 +512,9 @@ The following arguments are supported:
512512
The `auth_options` object supports the following:
513513

514514
* `auto_create_discovery_anonymous_auth` - (Optional, Bool) If set to `true`, the rbac rule will be created automatically which allow anonymous user to access '/.well-known/openid-configuration' and '/openid/v1/jwks'.
515-
* `issuer` - (Optional, String) Specify service-account-issuer. If use_tke_default is set to `true`, please set this parameter value to empty string or just ignore it.
516-
* `jwks_uri` - (Optional, String) Specify service-account-jwks-uri. If use_tke_default is set to `true`, please set this parameter value to empty string or just ignore it.
517-
* `use_tke_default` - (Optional, Bool) If set to `true`, the issuer and jwks_uri will be generated automatically by tke, please use empty string as value of issuer and jwks_uri.
515+
* `issuer` - (Optional, String) Specify service-account-issuer. If use_tke_default is set to `true`, please do not set this field, it will be ignored anyway.
516+
* `jwks_uri` - (Optional, String) Specify service-account-jwks-uri. If use_tke_default is set to `true`, please do not set this field, it will be ignored anyway.
517+
* `use_tke_default` - (Optional, Bool) If set to `true`, the issuer and jwks_uri will be generated automatically by tke, please do not set issuer and jwks_uri, and they will be ignored.
518518

519519
The `cluster_audit` object supports the following:
520520

0 commit comments

Comments
 (0)