Skip to content

Commit 4a55110

Browse files
authored
fix(tke): [119383480] tencentcloud_kubernetes_node_pool support instance_name_style param (#2791)
* add * add * add
1 parent 0a60330 commit 4a55110

File tree

4 files changed

+38
-8
lines changed

4 files changed

+38
-8
lines changed

.changelog/2791.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
resource/tencentcloud_kubernetes_node_pool: support `instance_name_style` param
3+
```

tencentcloud/services/tke/resource_tc_kubernetes_node_pool.go

Lines changed: 6 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_node_pool_extension.go

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,14 @@ func resourceTencentCloudKubernetesNodePoolReadPostHandleResponse1(ctx context.C
307307
if _, ok := d.GetOk("cam_role_name"); ok || launchCfg.CamRoleName != nil {
308308
launchConfig["cam_role_name"] = launchCfg.CamRoleName
309309
}
310-
if launchCfg.InstanceNameSettings != nil && launchCfg.InstanceNameSettings.InstanceName != nil {
311-
launchConfig["instance_name"] = launchCfg.InstanceNameSettings.InstanceName
310+
if launchCfg.InstanceNameSettings != nil {
311+
if launchCfg.InstanceNameSettings.InstanceName != nil {
312+
launchConfig["instance_name"] = launchCfg.InstanceNameSettings.InstanceName
313+
}
314+
315+
if launchCfg.InstanceNameSettings.InstanceNameStyle != nil {
316+
launchConfig["instance_name_style"] = launchCfg.InstanceNameSettings.InstanceNameStyle
317+
}
312318
}
313319
if launchCfg.HostNameSettings != nil && launchCfg.HostNameSettings.HostName != nil {
314320
launchConfig["host_name"] = launchCfg.HostNameSettings.HostName
@@ -1015,10 +1021,17 @@ func composedKubernetesAsScalingConfigParaSerial(dMap map[string]interface{}, me
10151021
request.CamRoleName = helper.String(v.(string))
10161022
}
10171023

1024+
tmpInstanceNameSettings := &as.InstanceNameSettings{}
10181025
if v, ok := dMap["instance_name"]; ok && v != "" {
1019-
request.InstanceNameSettings = &as.InstanceNameSettings{
1020-
InstanceName: helper.String(v.(string)),
1021-
}
1026+
tmpInstanceNameSettings.InstanceName = helper.String(v.(string))
1027+
}
1028+
1029+
if v, ok := dMap["instance_name_style"]; ok && v != "" {
1030+
tmpInstanceNameSettings.InstanceNameStyle = helper.String(v.(string))
1031+
}
1032+
1033+
if tmpInstanceNameSettings.InstanceName != nil || tmpInstanceNameSettings.InstanceNameStyle != nil {
1034+
request.InstanceNameSettings = tmpInstanceNameSettings
10221035
}
10231036

10241037
if v, ok := dMap["host_name"]; ok && v != "" {
@@ -1169,10 +1182,17 @@ func composeAsLaunchConfigModifyRequest(d *schema.ResourceData, launchConfigId s
11691182
}
11701183
}
11711184

1185+
tmpInstanceNameSettings := &as.InstanceNameSettings{}
11721186
if v, ok := dMap["instance_name"]; ok && v != "" {
1173-
request.InstanceNameSettings = &as.InstanceNameSettings{
1174-
InstanceName: helper.String(v.(string)),
1175-
}
1187+
tmpInstanceNameSettings.InstanceName = helper.String(v.(string))
1188+
}
1189+
1190+
if v, ok := dMap["instance_name_style"]; ok && v != "" {
1191+
tmpInstanceNameSettings.InstanceNameStyle = helper.String(v.(string))
1192+
}
1193+
1194+
if tmpInstanceNameSettings.InstanceName != nil || tmpInstanceNameSettings.InstanceNameStyle != nil {
1195+
request.InstanceNameSettings = tmpInstanceNameSettings
11761196
}
11771197

11781198
if v, ok := dMap["host_name"]; ok && v != "" {

website/docs/r/kubernetes_node_pool.html.markdown

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ The `auto_scaling_config` object supports the following:
198198
* `instance_charge_type_prepaid_period` - (Optional, Int) The tenancy (in 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`.
199199
* `instance_charge_type_prepaid_renew_flag` - (Optional, String) 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`.
200200
* `instance_charge_type` - (Optional, String) Charge type of instance. Valid values are `PREPAID`, `POSTPAID_BY_HOUR`, `SPOTPAID`. The default is `POSTPAID_BY_HOUR`. NOTE: `SPOTPAID` instance must set `spot_instance_type` and `spot_max_price` at the same time.
201+
* `instance_name_style` - (Optional, String) Type of CVM instance name. Valid values: `ORIGINAL` and `UNIQUE`. Default value: `ORIGINAL`. For usage, refer to `InstanceNameSettings` in https://www.tencentcloud.com/document/product/377/31001.
201202
* `instance_name` - (Optional, String) Instance name, no more than 60 characters. For usage, refer to `InstanceNameSettings` in https://www.tencentcloud.com/document/product/377/31001.
202203
* `internet_charge_type` - (Optional, String) Charge types for network traffic. Valid value: `BANDWIDTH_PREPAID`, `TRAFFIC_POSTPAID_BY_HOUR` and `BANDWIDTH_PACKAGE`.
203204
* `internet_max_bandwidth_out` - (Optional, Int) Max bandwidth of Internet access in Mbps. Default is `0`.

0 commit comments

Comments
 (0)