Skip to content

Commit 37d96bc

Browse files
committed
add
1 parent 76fad48 commit 37d96bc

5 files changed

+77
-4
lines changed

tencentcloud/services/tke/resource_tc_kubernetes_cluster_extension.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1981,6 +1981,26 @@ func tkeGetCvmRunInstancesPara(dMap map[string]interface{}, meta interface{},
19811981
request.HpcClusterId = helper.String(v.(string))
19821982
}
19831983

1984+
if v, ok := dMap["tags"].([]interface{}); ok && len(v) != 0 {
1985+
tmpTagSpec := cvm.TagSpecification{}
1986+
tmpTagSpec.ResourceType = helper.String("instance")
1987+
for _, item := range v {
1988+
value := item.(map[string]interface{})
1989+
tmpTag := cvm.Tag{}
1990+
if v, ok := value["key"].(string); ok && v != "" {
1991+
tmpTag.Key = &v
1992+
}
1993+
1994+
if v, ok := value["value"].(string); ok && v != "" {
1995+
tmpTag.Value = &v
1996+
}
1997+
1998+
tmpTagSpec.Tags = append(tmpTagSpec.Tags, &tmpTag)
1999+
}
2000+
2001+
request.TagSpecification = append(request.TagSpecification, &tmpTagSpec)
2002+
}
2003+
19842004
cvmJson = request.ToJsonString()
19852005

19862006
cvmJson = strings.Replace(cvmJson, `"Password":"",`, "", -1)

tencentcloud/services/tke/resource_tc_kubernetes_scale_worker.go

Lines changed: 22 additions & 0 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_scale_worker.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,12 @@ resource "tencentcloud_kubernetes_scale_worker" "example" {
4949
enhanced_security_service = false
5050
enhanced_monitor_service = false
5151
user_data = "dGVzdA=="
52-
password = "AABBccdd1122"
52+
password = "Password@123"
53+
54+
tags {
55+
key = "createBy"
56+
value = "Terraform"
57+
}
5358
}
5459
5560
create_result_output_file = "my_output_file_path"
@@ -102,7 +107,7 @@ resource "tencentcloud_kubernetes_scale_worker" "example" {
102107
enhanced_security_service = false
103108
enhanced_monitor_service = false
104109
user_data = "dGVzdA=="
105-
password = "AABBccdd1122"
110+
password = "Password@123"
106111
}
107112
}
108113
```

tencentcloud/services/tke/resource_tc_kubernetes_scale_worker_extension.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,21 @@ func resourceTencentCloudKubernetesScaleWorkerReadPostRequest1(ctx context.Conte
9898
}
9999

100100
mapping["data_disk"] = dataDisks // worker_config.data_disk
101+
102+
if instance.Tags != nil {
103+
tmpList := make([]interface{}, 0, len(instance.Tags))
104+
for _, item := range instance.Tags {
105+
tmpTag := map[string]interface{}{
106+
"key": item.Key,
107+
"value": item.Value,
108+
}
109+
110+
tmpList = append(tmpList, tmpTag)
111+
}
112+
113+
mapping["tags"] = tmpList
114+
}
115+
101116
instanceList = append(instanceList, mapping)
102117
}
103118
if importFlag1 {

website/docs/r/kubernetes_scale_worker.html.markdown

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,12 @@ resource "tencentcloud_kubernetes_scale_worker" "example" {
6060
enhanced_security_service = false
6161
enhanced_monitor_service = false
6262
user_data = "dGVzdA=="
63-
password = "AABBccdd1122"
63+
password = "Password@123"
64+
65+
tags {
66+
key = "createBy"
67+
value = "Terraform"
68+
}
6469
}
6570
6671
create_result_output_file = "my_output_file_path"
@@ -113,7 +118,7 @@ resource "tencentcloud_kubernetes_scale_worker" "example" {
113118
enhanced_security_service = false
114119
enhanced_monitor_service = false
115120
user_data = "dGVzdA=="
116-
password = "AABBccdd1122"
121+
password = "Password@123"
117122
}
118123
}
119124
```
@@ -166,6 +171,11 @@ The `gpu_args` object supports the following:
166171
* `driver` - (Optional, Map) GPU driver version. Format like: `{ version: String, name: String }`. `version`: Version of GPU driver or CUDA; `name`: Name of GPU driver or CUDA.
167172
* `mig_enable` - (Optional, Bool) Whether to enable MIG.
168173

174+
The `tags` object of `worker_config` supports the following:
175+
176+
* `key` - (Required, String, ForceNew) Tag key.
177+
* `value` - (Required, String, ForceNew) Tag value.
178+
169179
The `taints` object supports the following:
170180

171181
* `effect` - (Optional, String, ForceNew) Effect of the taint.
@@ -200,6 +210,7 @@ The `worker_config` object supports the following:
200210
* `security_group_ids` - (Optional, List, ForceNew) Security groups to which a CVM instance belongs.
201211
* `system_disk_size` - (Optional, Int, ForceNew) Volume of system disk in GB. Default is `50`.
202212
* `system_disk_type` - (Optional, String, ForceNew) System disk type. For more information on limits of system disk types, see [Storage Overview](https://intl.cloud.tencent.com/document/product/213/4952). Valid values: `LOCAL_BASIC`: local disk, `LOCAL_SSD`: local SSD disk, `CLOUD_SSD`: SSD, `CLOUD_PREMIUM`: Premium Cloud Storage. NOTE: `CLOUD_BASIC`, `LOCAL_BASIC` and `LOCAL_SSD` are deprecated.
213+
* `tags` - (Optional, List, ForceNew) Tag pairs.
203214
* `user_data` - (Optional, String, ForceNew) User data provided to instances, needs to be encoded in base64, and the maximum supported data size is 16KB.
204215

205216
## Attributes Reference

0 commit comments

Comments
 (0)