Skip to content

Commit 62c028a

Browse files
authored
fix: add hostName (#1298)
* fix: add hostName * fix: modify field properties * fix: modify node_pool read * fix: modify field properties * fix: update url Co-authored-by: arunma <arunma@tencent.com>
1 parent eb3e7ec commit 62c028a

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

tencentcloud/resource_tc_kubernetes_node_pool.go

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,18 @@ func composedKubernetesAsScalingConfigPara() map[string]*schema.Schema {
351351
ForceNew: true,
352352
Description: "Name of cam role.",
353353
},
354+
"instance_name": {
355+
Type: schema.TypeString,
356+
Optional: true,
357+
Computed: true,
358+
Description: "Instance name, no more than 60 characters. For usage, refer to `InstanceNameSettings` in https://www.tencentcloud.com/document/product/377/31001.",
359+
},
360+
"host_name": {
361+
Type: schema.TypeString,
362+
Optional: true,
363+
Computed: true,
364+
Description: "The hostname of the cloud server, dot (.) and dash (-) cannot be used as the first and last characters of HostName and cannot be used consecutively. Windows instances are not supported. Examples of other types (Linux, etc.): The character length is [2, 40], multiple periods are allowed, and there is a paragraph between the dots, and each paragraph is allowed to consist of letters (unlimited case), numbers and dashes (-). Pure numbers are not allowed. For usage, refer to `HostNameSettings` in https://www.tencentcloud.com/document/product/377/31001.",
365+
},
354366
}
355367

356368
return needSchema
@@ -790,6 +802,18 @@ func composedKubernetesAsScalingConfigParaSerial(dMap map[string]interface{}, me
790802
if v, ok := dMap["cam_role_name"]; ok {
791803
request.CamRoleName = helper.String(v.(string))
792804
}
805+
806+
if v, ok := dMap["instance_name"]; ok && v != "" {
807+
request.InstanceNameSettings = &as.InstanceNameSettings{
808+
InstanceName: helper.String(v.(string)),
809+
}
810+
}
811+
812+
if v, ok := dMap["host_name"]; ok && v != "" {
813+
request.HostNameSettings = &as.HostNameSettings{
814+
HostName: helper.String(v.(string)),
815+
}
816+
}
793817
result = request.ToJsonString()
794818
return result, errRet
795819
}
@@ -897,6 +921,18 @@ func composeAsLaunchConfigModifyRequest(d *schema.ResourceData, launchConfigId s
897921
}
898922
}
899923

924+
if v, ok := dMap["instance_name"]; ok && v != "" {
925+
request.InstanceNameSettings = &as.InstanceNameSettings{
926+
InstanceName: helper.String(v.(string)),
927+
}
928+
}
929+
930+
if v, ok := dMap["host_name"]; ok && v != "" {
931+
request.HostNameSettings = &as.HostNameSettings{
932+
HostName: helper.String(v.(string)),
933+
}
934+
}
935+
900936
request.InstanceChargeType = &chargeType
901937

902938
return request
@@ -1104,6 +1140,13 @@ func resourceKubernetesNodePoolRead(d *schema.ResourceData, meta interface{}) er
11041140
if _, ok := d.GetOk("cam_role_name"); ok || launchCfg.CamRoleName != nil {
11051141
launchConfig["cam_role_name"] = launchCfg.CamRoleName
11061142
}
1143+
if launchCfg.InstanceNameSettings != nil && launchCfg.InstanceNameSettings.InstanceName != nil {
1144+
launchConfig["instance_name"] = launchCfg.InstanceNameSettings.InstanceName
1145+
}
1146+
if launchCfg.HostNameSettings != nil && launchCfg.HostNameSettings.HostName != nil {
1147+
launchConfig["host_name"] = launchCfg.HostNameSettings.HostName
1148+
}
1149+
11071150
asgConfig := make([]interface{}, 0, 1)
11081151
asgConfig = append(asgConfig, launchConfig)
11091152
if err := d.Set("auto_scaling_config", asgConfig); err != nil {

website/docs/r/kubernetes_node_pool.html.markdown

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,9 +186,11 @@ The `auto_scaling_config` object supports the following:
186186
* `data_disk` - (Optional, List) Configurations of data disk.
187187
* `enhanced_monitor_service` - (Optional, Bool, ForceNew) To specify whether to enable cloud monitor service. Default is TRUE.
188188
* `enhanced_security_service` - (Optional, Bool, ForceNew) To specify whether to enable cloud security service. Default is TRUE.
189+
* `host_name` - (Optional, String) The hostname of the cloud server, dot (.) and dash (-) cannot be used as the first and last characters of HostName and cannot be used consecutively. Windows instances are not supported. Examples of other types (Linux, etc.): The character length is [2, 40], multiple periods are allowed, and there is a paragraph between the dots, and each paragraph is allowed to consist of letters (unlimited case), numbers and dashes (-). Pure numbers are not allowed. For usage, refer to `HostNameSettings` in https://www.tencentcloud.com/document/product/377/31001.
189190
* `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`.
190191
* `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`.
191192
* `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.
193+
* `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.
192194
* `internet_charge_type` - (Optional, String) Charge types for network traffic. Valid value: `BANDWIDTH_PREPAID`, `TRAFFIC_POSTPAID_BY_HOUR`, `TRAFFIC_POSTPAID_BY_HOUR` and `BANDWIDTH_PACKAGE`.
193195
* `internet_max_bandwidth_out` - (Optional, Int) Max bandwidth of Internet access in Mbps. Default is `0`.
194196
* `key_ids` - (Optional, List, ForceNew) ID list of keys.

0 commit comments

Comments
 (0)