diff --git a/tencentcloud/resource_tc_kubernetes_node_pool.go b/tencentcloud/resource_tc_kubernetes_node_pool.go index 9b6a2bfa47..58bcd0c596 100644 --- a/tencentcloud/resource_tc_kubernetes_node_pool.go +++ b/tencentcloud/resource_tc_kubernetes_node_pool.go @@ -351,6 +351,18 @@ func composedKubernetesAsScalingConfigPara() map[string]*schema.Schema { ForceNew: true, Description: "Name of cam role.", }, + "instance_name": { + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: "Instance name, no more than 60 characters. For usage, refer to `InstanceNameSettings` in https://www.tencentcloud.com/document/product/377/31001.", + }, + "host_name": { + Type: schema.TypeString, + Optional: true, + Computed: true, + 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.", + }, } return needSchema @@ -790,6 +802,18 @@ func composedKubernetesAsScalingConfigParaSerial(dMap map[string]interface{}, me if v, ok := dMap["cam_role_name"]; ok { request.CamRoleName = helper.String(v.(string)) } + + if v, ok := dMap["instance_name"]; ok && v != "" { + request.InstanceNameSettings = &as.InstanceNameSettings{ + InstanceName: helper.String(v.(string)), + } + } + + if v, ok := dMap["host_name"]; ok && v != "" { + request.HostNameSettings = &as.HostNameSettings{ + HostName: helper.String(v.(string)), + } + } result = request.ToJsonString() return result, errRet } @@ -897,6 +921,18 @@ func composeAsLaunchConfigModifyRequest(d *schema.ResourceData, launchConfigId s } } + if v, ok := dMap["instance_name"]; ok && v != "" { + request.InstanceNameSettings = &as.InstanceNameSettings{ + InstanceName: helper.String(v.(string)), + } + } + + if v, ok := dMap["host_name"]; ok && v != "" { + request.HostNameSettings = &as.HostNameSettings{ + HostName: helper.String(v.(string)), + } + } + request.InstanceChargeType = &chargeType return request @@ -1104,6 +1140,13 @@ func resourceKubernetesNodePoolRead(d *schema.ResourceData, meta interface{}) er 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.HostNameSettings != nil && launchCfg.HostNameSettings.HostName != nil { + launchConfig["host_name"] = launchCfg.HostNameSettings.HostName + } + asgConfig := make([]interface{}, 0, 1) asgConfig = append(asgConfig, launchConfig) if err := d.Set("auto_scaling_config", asgConfig); err != nil { diff --git a/website/docs/r/kubernetes_node_pool.html.markdown b/website/docs/r/kubernetes_node_pool.html.markdown index 298bb6ce5b..6c4698117a 100644 --- a/website/docs/r/kubernetes_node_pool.html.markdown +++ b/website/docs/r/kubernetes_node_pool.html.markdown @@ -186,9 +186,11 @@ The `auto_scaling_config` object supports the following: * `data_disk` - (Optional, List) Configurations of data disk. * `enhanced_monitor_service` - (Optional, Bool, ForceNew) To specify whether to enable cloud monitor service. Default is TRUE. * `enhanced_security_service` - (Optional, Bool, ForceNew) To specify whether to enable cloud security service. Default is TRUE. +* `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. * `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` - (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`, `TRAFFIC_POSTPAID_BY_HOUR` and `BANDWIDTH_PACKAGE`. * `internet_max_bandwidth_out` - (Optional, Int) Max bandwidth of Internet access in Mbps. Default is `0`. * `key_ids` - (Optional, List, ForceNew) ID list of keys.