Skip to content

Commit 4ae3b2d

Browse files
authored
feat(tke): [116938571]docs/tke requirement (#2686)
* update cluster and scale_worker field description * iacg generates TKE code * update resource import doc
1 parent a42266b commit 4ae3b2d

8 files changed

+84
-44
lines changed

tencentcloud/services/tke/resource_tc_kubernetes_auth_attachment.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,4 +161,12 @@ output "identity_url" {
161161
value = data.tencentcloud_cam_oidc_config.oidc_config.identity_url
162162
}
163163
164+
```
165+
166+
Import
167+
168+
tke cluster authentication can be imported, e.g.
169+
170+
```
171+
$ terraform import tencentcloud_kubernetes_auth_attachment.test cls-xxx
164172
```

tencentcloud/services/tke/resource_tc_kubernetes_cluster.go

Lines changed: 19 additions & 27 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tencentcloud/services/tke/resource_tc_kubernetes_cluster.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ resource "tencentcloud_kubernetes_cluster" "example" {
9090
internet_max_bandwidth_out = 100
9191
public_ip_assigned = true
9292
subnet_id = local.first_subnet_id
93-
img_id = local.image_id
93+
# img_id = local.image_id
9494
9595
data_disk {
9696
disk_type = "CLOUD_PREMIUM"
@@ -484,7 +484,7 @@ resource "tencentcloud_kubernetes_cluster" "example" {
484484
internet_max_bandwidth_out = 100
485485
public_ip_assigned = true
486486
subnet_id = local.first_subnet_id
487-
img_id = local.image_id
487+
# img_id = local.image_id
488488
489489
data_disk {
490490
disk_type = "CLOUD_PREMIUM"
@@ -588,7 +588,7 @@ resource "tencentcloud_kubernetes_cluster" "cluster_with_addon" {
588588
internet_max_bandwidth_out = 100
589589
public_ip_assigned = true
590590
subnet_id = data.tencentcloud_vpc_subnets.vpc_first.instance_list.0.subnet_id
591-
img_id = "img-rkiynh11"
591+
# img_id = "img-rkiynh11"
592592
enhanced_security_service = false
593593
enhanced_monitor_service = false
594594
user_data = "dGVzdA=="
@@ -777,4 +777,12 @@ resource "tencentcloud_kubernetes_cluster" "managed_cluster" {
777777
topic_id = "" # optional
778778
}
779779
}
780+
```
781+
782+
Import
783+
784+
tke cluster can be imported, e.g.
785+
786+
```
787+
$ terraform import tencentcloud_kubernetes_cluster.test cls-xxx
780788
```

tencentcloud/services/tke/resource_tc_kubernetes_scale_worker.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,4 +99,12 @@ resource tencentcloud_kubernetes_scale_worker test_scale {
9999
password = "AABBccdd1122"
100100
}
101101
}
102+
```
103+
104+
Import
105+
106+
tke scale worker can be imported, e.g.
107+
108+
```
109+
$ terraform import tencentcloud_kubernetes_scale_worker.test cls-xxx#ins-xxx
102110
```

tencentcloud/services/tke/service_tencentcloud_tke.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3162,7 +3162,7 @@ func (me *TkeService) DescribeKubernetesClusterById(ctx context.Context, cluster
31623162
logId := tccommon.GetLogId(ctx)
31633163

31643164
request := tke.NewDescribeClustersRequest()
3165-
request.ClusterIds = []*string{&clusterId}
3165+
request.ClusterIds = []*string{helper.String(clusterId)}
31663166

31673167
defer func() {
31683168
if errRet != nil {
@@ -3179,7 +3179,7 @@ func (me *TkeService) DescribeKubernetesClusterById(ctx context.Context, cluster
31793179
}
31803180
log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), response.ToJsonString())
31813181

3182-
if response == nil || len(response.Response.Clusters) < 1 {
3182+
if len(response.Response.Clusters) < 1 {
31833183
return
31843184
}
31853185

@@ -3191,7 +3191,7 @@ func (me *TkeService) DescribeKubernetesClusterById1(ctx context.Context, cluste
31913191
logId := tccommon.GetLogId(ctx)
31923192

31933193
request := tke.NewDescribeClusterInstancesRequest()
3194-
request.ClusterId = &clusterId
3194+
request.ClusterId = helper.String(clusterId)
31953195

31963196
defer func() {
31973197
if errRet != nil {
@@ -3216,7 +3216,7 @@ func (me *TkeService) DescribeKubernetesClusterById2(ctx context.Context, cluste
32163216
logId := tccommon.GetLogId(ctx)
32173217

32183218
request := tke.NewDescribeClusterSecurityRequest()
3219-
request.ClusterId = &clusterId
3219+
request.ClusterId = helper.String(clusterId)
32203220

32213221
defer func() {
32223222
if errRet != nil {

website/docs/r/kubernetes_auth_attachment.html.markdown

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,3 +196,11 @@ In addition to all arguments above, the following attributes are exported:
196196
* `tke_default_jwks_uri` - The default jwks_uri of tke. If use_tke_default is set to `true`, this parameter will be set to the default value.
197197

198198

199+
## Import
200+
201+
tke cluster authentication can be imported, e.g.
202+
203+
```
204+
$ terraform import tencentcloud_kubernetes_auth_attachment.test cls-xxx
205+
```
206+

website/docs/r/kubernetes_cluster.html.markdown

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ resource "tencentcloud_kubernetes_cluster" "example" {
101101
internet_max_bandwidth_out = 100
102102
public_ip_assigned = true
103103
subnet_id = local.first_subnet_id
104-
img_id = local.image_id
104+
# img_id = local.image_id
105105
106106
data_disk {
107107
disk_type = "CLOUD_PREMIUM"
@@ -492,7 +492,7 @@ resource "tencentcloud_kubernetes_cluster" "example" {
492492
internet_max_bandwidth_out = 100
493493
public_ip_assigned = true
494494
subnet_id = local.first_subnet_id
495-
img_id = local.image_id
495+
# img_id = local.image_id
496496
497497
data_disk {
498498
disk_type = "CLOUD_PREMIUM"
@@ -596,10 +596,10 @@ resource "tencentcloud_kubernetes_cluster" "cluster_with_addon" {
596596
internet_max_bandwidth_out = 100
597597
public_ip_assigned = true
598598
subnet_id = data.tencentcloud_vpc_subnets.vpc_first.instance_list.0.subnet_id
599-
img_id = "img-rkiynh11"
600-
enhanced_security_service = false
601-
enhanced_monitor_service = false
602-
user_data = "dGVzdA=="
599+
# img_id = "img-rkiynh11"
600+
enhanced_security_service = false
601+
enhanced_monitor_service = false
602+
user_data = "dGVzdA=="
603603
# password = "ZZXXccvv1212" // Optional, should be set if key_ids not set.
604604
key_ids = "skey-11112222"
605605
}
@@ -816,7 +816,7 @@ The following arguments are supported:
816816
* `cluster_max_service_num` - (Optional, Int, ForceNew) The maximum number of services in the cluster. Default is 256. The range is from 32 to 32768. When its power unequal to 2, it will round upward to the closest power of 2.
817817
* `cluster_name` - (Optional, String) Name of the cluster.
818818
* `cluster_os_type` - (Optional, String, ForceNew) Image type of the cluster os, the available values include: 'GENERAL'. Default is 'GENERAL'.
819-
* `cluster_os` - (Optional, String, ForceNew) Operating system of the cluster, the available values include: 'centos7.6.0_x64','ubuntu18.04.1x86_64','tlinux2.4x86_64'. Default is 'tlinux2.4x86_64'.
819+
* `cluster_os` - (Optional, String, ForceNew) Cluster operating system, supports setting public images (the field passes the corresponding image Name) and custom images (the field passes the corresponding image ID). For details, please refer to: https://cloud.tencent.com/document/product/457/68289.
820820
* `cluster_subnet_id` - (Optional, String, ForceNew) Subnet ID of the cluster, such as: subnet-b3p7d7q5.
821821
* `cluster_version` - (Optional, String) Version of the cluster. Use `tencentcloud_kubernetes_available_cluster_versions` to get the upgradable cluster version.
822822
* `container_runtime` - (Optional, String, ForceNew) Runtime type of the cluster, the available values include: 'docker' and 'containerd'.The Kubernetes v1.24 has removed dockershim, so please use containerd in v1.24 or higher.Default is 'docker'.
@@ -847,7 +847,7 @@ The following arguments are supported:
847847
* `unschedulable` - (Optional, Int, ForceNew) Sets whether the joining node participates in the schedule. Default is '0'. Participate in scheduling.
848848
* `upgrade_instances_follow_cluster` - (Optional, Bool) Indicates whether upgrade all instances when cluster_version change. Default is false.
849849
* `vpc_cni_type` - (Optional, String) Distinguish between shared network card multi-IP mode and independent network card mode. Fill in `tke-route-eni` for shared network card multi-IP mode and `tke-direct-eni` for independent network card mode. The default is shared network card mode. When it is necessary to turn off the vpc-cni container network capability, both `eni_subnet_ids` and `vpc_cni_type` must be set to empty.
850-
* `worker_config` - (Optional, List, ForceNew) Deploy the machine configuration information of the 'WORKER' service, and create <=20 units for common users. The other 'WORK' service are added by 'tencentcloud_kubernetes_worker'.
850+
* `worker_config` - (Optional, List, ForceNew) Deploy the machine configuration information of the 'WORKER' service, and create <=20 units for common users. The other 'WORK' service are added by 'tencentcloud_kubernetes_scale_worker'.
851851

852852
The `auth_options` object supports the following:
853853

@@ -935,7 +935,7 @@ The `master_config` object supports the following:
935935
* `enhanced_security_service` - (Optional, Bool, ForceNew) To specify whether to enable cloud security service. Default is TRUE.
936936
* `hostname` - (Optional, String, ForceNew) The host name of the attached instance. Dot (.) and dash (-) cannot be used as the first and last characters of HostName and cannot be used consecutively. Windows example: The length of the name character is [2, 15], letters (capitalization is not restricted), numbers and dashes (-) are allowed, dots (.) are not supported, and not all numbers are allowed. Examples of other types (Linux, etc.): The character length is [2, 60], and multiple dots are allowed. There is a segment between the dots. Each segment allows letters (with no limitation on capitalization), numbers and dashes (-).
937937
* `hpc_cluster_id` - (Optional, String) Id of cvm hpc cluster.
938-
* `img_id` - (Optional, String) The valid image id, format of img-xxx.
938+
* `img_id` - (Optional, String) The valid image id, format of img-xxx. Note: `img_id` will be replaced with the image corresponding to TKE `cluster_os`.
939939
* `instance_charge_type_prepaid_period` - (Optional, Int, ForceNew) The tenancy (time unit is month) of the prepaid instance. NOTE: it only works when instance_charge_type is set to `PREPAID`. Valid values are `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `10`, `11`, `12`, `24`, `36`.
940940
* `instance_charge_type_prepaid_renew_flag` - (Optional, String, ForceNew) Auto renewal flag. Valid values: `NOTIFY_AND_AUTO_RENEW`: notify upon expiration and renew automatically, `NOTIFY_AND_MANUAL_RENEW`: notify upon expiration but do not renew automatically, `DISABLE_NOTIFY_AND_MANUAL_RENEW`: neither notify upon expiration nor renew automatically. Default value: `NOTIFY_AND_MANUAL_RENEW`. If this parameter is specified as `NOTIFY_AND_AUTO_RENEW`, the instance will be automatically renewed on a monthly basis if the account balance is sufficient. NOTE: it only works when instance_charge_type is set to `PREPAID`.
941941
* `instance_charge_type` - (Optional, String, ForceNew) The charge type of instance. Valid values are `PREPAID` and `POSTPAID_BY_HOUR`. The default is `POSTPAID_BY_HOUR`. Note: TencentCloud International only supports `POSTPAID_BY_HOUR`, `PREPAID` instance will not terminated after cluster deleted, and may not allow to delete before expired.
@@ -977,7 +977,7 @@ The `worker_config` object supports the following:
977977
* `enhanced_security_service` - (Optional, Bool, ForceNew) To specify whether to enable cloud security service. Default is TRUE.
978978
* `hostname` - (Optional, String, ForceNew) The host name of the attached instance. Dot (.) and dash (-) cannot be used as the first and last characters of HostName and cannot be used consecutively. Windows example: The length of the name character is [2, 15], letters (capitalization is not restricted), numbers and dashes (-) are allowed, dots (.) are not supported, and not all numbers are allowed. Examples of other types (Linux, etc.): The character length is [2, 60], and multiple dots are allowed. There is a segment between the dots. Each segment allows letters (with no limitation on capitalization), numbers and dashes (-).
979979
* `hpc_cluster_id` - (Optional, String) Id of cvm hpc cluster.
980-
* `img_id` - (Optional, String) The valid image id, format of img-xxx.
980+
* `img_id` - (Optional, String) The valid image id, format of img-xxx. Note: `img_id` will be replaced with the image corresponding to TKE `cluster_os`.
981981
* `instance_charge_type_prepaid_period` - (Optional, Int, ForceNew) The tenancy (time unit is month) of the prepaid instance. NOTE: it only works when instance_charge_type is set to `PREPAID`. Valid values are `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `10`, `11`, `12`, `24`, `36`.
982982
* `instance_charge_type_prepaid_renew_flag` - (Optional, String, ForceNew) Auto renewal flag. Valid values: `NOTIFY_AND_AUTO_RENEW`: notify upon expiration and renew automatically, `NOTIFY_AND_MANUAL_RENEW`: notify upon expiration but do not renew automatically, `DISABLE_NOTIFY_AND_MANUAL_RENEW`: neither notify upon expiration nor renew automatically. Default value: `NOTIFY_AND_MANUAL_RENEW`. If this parameter is specified as `NOTIFY_AND_AUTO_RENEW`, the instance will be automatically renewed on a monthly basis if the account balance is sufficient. NOTE: it only works when instance_charge_type is set to `PREPAID`.
983983
* `instance_charge_type` - (Optional, String, ForceNew) The charge type of instance. Valid values are `PREPAID` and `POSTPAID_BY_HOUR`. The default is `POSTPAID_BY_HOUR`. Note: TencentCloud International only supports `POSTPAID_BY_HOUR`, `PREPAID` instance will not terminated after cluster deleted, and may not allow to delete before expired.
@@ -1016,3 +1016,11 @@ In addition to all arguments above, the following attributes are exported:
10161016
* `lan_ip` - LAN IP of the cvm.
10171017

10181018

1019+
## Import
1020+
1021+
tke cluster can be imported, e.g.
1022+
1023+
```
1024+
$ terraform import tencentcloud_kubernetes_cluster.test cls-xxx
1025+
```
1026+

website/docs/r/kubernetes_scale_worker.html.markdown

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,3 +200,11 @@ In addition to all arguments above, the following attributes are exported:
200200
* `lan_ip` - LAN IP of the cvm.
201201

202202

203+
## Import
204+
205+
tke scale worker can be imported, e.g.
206+
207+
```
208+
$ terraform import tencentcloud_kubernetes_scale_worker.test cls-xxx#ins-xxx
209+
```
210+

0 commit comments

Comments
 (0)