Skip to content

fix(tke): [119383480] tencentcloud_kubernetes_node_pool support instance_name_style param #2791

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/2791.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/tencentcloud_kubernetes_node_pool: support `instance_name_style` param
```
6 changes: 6 additions & 0 deletions tencentcloud/services/tke/resource_tc_kubernetes_node_pool.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -307,8 +307,14 @@ func resourceTencentCloudKubernetesNodePoolReadPostHandleResponse1(ctx context.C
if _, ok := d.GetOk("cam_role_name"); ok || launchCfg.CamRoleName != nil {
launchConfig["cam_role_name"] = launchCfg.CamRoleName
}
if launchCfg.InstanceNameSettings != nil && launchCfg.InstanceNameSettings.InstanceName != nil {
launchConfig["instance_name"] = launchCfg.InstanceNameSettings.InstanceName
if launchCfg.InstanceNameSettings != nil {
if launchCfg.InstanceNameSettings.InstanceName != nil {
launchConfig["instance_name"] = launchCfg.InstanceNameSettings.InstanceName
}

if launchCfg.InstanceNameSettings.InstanceNameStyle != nil {
launchConfig["instance_name_style"] = launchCfg.InstanceNameSettings.InstanceNameStyle
}
}
if launchCfg.HostNameSettings != nil && launchCfg.HostNameSettings.HostName != nil {
launchConfig["host_name"] = launchCfg.HostNameSettings.HostName
Expand Down Expand Up @@ -1015,10 +1021,17 @@ func composedKubernetesAsScalingConfigParaSerial(dMap map[string]interface{}, me
request.CamRoleName = helper.String(v.(string))
}

tmpInstanceNameSettings := &as.InstanceNameSettings{}
if v, ok := dMap["instance_name"]; ok && v != "" {
request.InstanceNameSettings = &as.InstanceNameSettings{
InstanceName: helper.String(v.(string)),
}
tmpInstanceNameSettings.InstanceName = helper.String(v.(string))
}

if v, ok := dMap["instance_name_style"]; ok && v != "" {
tmpInstanceNameSettings.InstanceNameStyle = helper.String(v.(string))
}

if tmpInstanceNameSettings.InstanceName != nil || tmpInstanceNameSettings.InstanceNameStyle != nil {
request.InstanceNameSettings = tmpInstanceNameSettings
}

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

tmpInstanceNameSettings := &as.InstanceNameSettings{}
if v, ok := dMap["instance_name"]; ok && v != "" {
request.InstanceNameSettings = &as.InstanceNameSettings{
InstanceName: helper.String(v.(string)),
}
tmpInstanceNameSettings.InstanceName = helper.String(v.(string))
}

if v, ok := dMap["instance_name_style"]; ok && v != "" {
tmpInstanceNameSettings.InstanceNameStyle = helper.String(v.(string))
}

if tmpInstanceNameSettings.InstanceName != nil || tmpInstanceNameSettings.InstanceNameStyle != nil {
request.InstanceNameSettings = tmpInstanceNameSettings
}

if v, ok := dMap["host_name"]; ok && v != "" {
Expand Down
1 change: 1 addition & 0 deletions website/docs/r/kubernetes_node_pool.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ The `auto_scaling_config` object supports the following:
* `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`.
* `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`.
* `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.
* `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.
* `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.
* `internet_charge_type` - (Optional, String) Charge types for network traffic. Valid value: `BANDWIDTH_PREPAID`, `TRAFFIC_POSTPAID_BY_HOUR` and `BANDWIDTH_PACKAGE`.
* `internet_max_bandwidth_out` - (Optional, Int) Max bandwidth of Internet access in Mbps. Default is `0`.
Expand Down
Loading