Skip to content
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
43 changes: 43 additions & 0 deletions tencentcloud/resource_tc_kubernetes_node_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 2 additions & 0 deletions website/docs/r/kubernetes_node_pool.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down