Skip to content

Commit e8ee24d

Browse files
authored
Add hostname for k8s cluster attachment (#585)
1 parent 039856a commit e8ee24d

File tree

5 files changed

+42
-14
lines changed

5 files changed

+42
-14
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
## 1.53.3 (Unreleased)
2+
3+
ENHANCEMENTS:
4+
5+
* Data Source `tencentcloud_cbs_storages` add `throughput_performance` to support adding extra performance to the cbs resources.
6+
* Resource `tencentcloud_kubernetes_cluster_attachment` add `hostname` to support setting hostname with the attached instance.
7+
28
## 1.53.2 (February 01, 2021)
39

410
ENHANCEMENTS:

tencentcloud/data_source_tc_cbs_storages.go

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,11 @@ func dataSourceTencentCloudCbsStorages() *schema.Resource {
144144
Computed: true,
145145
Description: "Pay type of the CBS instance.",
146146
},
147+
"throughput_performance": {
148+
Type: schema.TypeInt,
149+
Computed: true,
150+
Description: "Add extra performance to the data disk. Only works when disk type is `CLOUD_TSSD` or `CLOUD_HSSD`.",
151+
},
147152
},
148153
},
149154
},
@@ -190,20 +195,21 @@ func dataSourceTencentCloudCbsStoragesRead(d *schema.ResourceData, meta interfac
190195
storageList := make([]map[string]interface{}, 0, len(storages))
191196
for _, storage := range storages {
192197
mapping := map[string]interface{}{
193-
"storage_id": storage.DiskId,
194-
"storage_name": storage.DiskName,
195-
"storage_usage": storage.DiskUsage,
196-
"storage_type": storage.DiskType,
197-
"availability_zone": storage.Placement.Zone,
198-
"project_id": storage.Placement.ProjectId,
199-
"storage_size": storage.DiskSize,
200-
"attached": storage.Attached,
201-
"instance_id": storage.InstanceId,
202-
"encrypt": storage.Encrypt,
203-
"create_time": storage.CreateTime,
204-
"status": storage.DiskState,
205-
"prepaid_renew_flag": storage.RenewFlag,
206-
"charge_type": storage.DiskChargeType,
198+
"storage_id": storage.DiskId,
199+
"storage_name": storage.DiskName,
200+
"storage_usage": storage.DiskUsage,
201+
"storage_type": storage.DiskType,
202+
"availability_zone": storage.Placement.Zone,
203+
"project_id": storage.Placement.ProjectId,
204+
"storage_size": storage.DiskSize,
205+
"attached": storage.Attached,
206+
"instance_id": storage.InstanceId,
207+
"encrypt": storage.Encrypt,
208+
"create_time": storage.CreateTime,
209+
"status": storage.DiskState,
210+
"prepaid_renew_flag": storage.RenewFlag,
211+
"charge_type": storage.DiskChargeType,
212+
"throughput_performance": storage.ThroughputPerformance,
207213
}
208214
if storage.Tags != nil {
209215
tags := make(map[string]interface{}, len(storage.Tags))

tencentcloud/resource_tc_kubernetes_cluster_attachment.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,15 @@ func resourceTencentCloudTkeClusterAttachment() *schema.Resource {
223223
Elem: &schema.Schema{Type: schema.TypeString},
224224
Description: "The key pair to use for the instance, it looks like skey-16jig7tx, it should be set if `password` not set.",
225225
},
226+
"hostname": {
227+
Type: schema.TypeString,
228+
ForceNew: true,
229+
Optional: true,
230+
Description: "The host name of the attached instance. " +
231+
"Dot (.) and dash (-) cannot be used as the first and last characters of HostName and cannot be used consecutively. " +
232+
"Windows example: The length of the name character is [2, 15], letters (capitalization is not restricted), numbers and dashes (-) are allowed, dots (.) are not supported, and not all numbers are allowed. " +
233+
"Examples of other types (Linux, etc.): The character length is [2, 60], and multiple dots are allowed. There is a segment between the dots. Each segment allows letters (with no limitation on capitalization), numbers and dashes (-).",
234+
},
226235
"worker_config": {
227236
Type: schema.TypeList,
228237
ForceNew: true,
@@ -392,6 +401,7 @@ func resourceTencentCloudTkeClusterAttachmentRead(d *schema.ResourceData, meta i
392401
if len(instance.LoginSettings.KeyIds) > 0 {
393402
_ = d.Set("key_ids", instance.LoginSettings.KeyIds)
394403
}
404+
395405
_ = d.Set("security_groups", helper.StringsInterfaces(instance.SecurityGroupIds))
396406
return nil
397407
}
@@ -439,6 +449,10 @@ func resourceTencentCloudTkeClusterAttachmentCreate(d *schema.ResourceData, meta
439449
}
440450

441451
request.InstanceAdvancedSettings.Labels = GetTkeLabels(d, "labels")
452+
if hostName, ok := d.GetOk("hostname"); ok {
453+
hostNameStr := hostName.(string)
454+
request.HostName = &hostNameStr
455+
}
442456

443457
/*cvm has been attached*/
444458
var err error

website/docs/d/cbs_storages.html.markdown

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,6 @@ In addition to all arguments above, the following attributes are exported:
5252
* `storage_type` - Types of storage medium.
5353
* `storage_usage` - Types of CBS.
5454
* `tags` - The available tags within this CBS.
55+
* `throughput_performance` - Add extra performance to the data disk. Only works when disk type is `CLOUD_TSSD` or `CLOUD_HSSD`.
5556

5657

website/docs/r/kubernetes_cluster_attachment.html.markdown

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ The following arguments are supported:
106106

107107
* `cluster_id` - (Required, ForceNew) ID of the cluster.
108108
* `instance_id` - (Required, ForceNew) ID of the CVM instance, this cvm will reinstall the system.
109+
* `hostname` - (Optional, ForceNew) The host name of the attached instance. Dot (.) and dash (-) cannot be used as the first and last characters of HostName and cannot be used consecutively. Windows example: The length of the name character is [2, 15], letters (capitalization is not restricted), numbers and dashes (-) are allowed, dots (.) are not supported, and not all numbers are allowed. Examples of other types (Linux, etc.): The character length is [2, 60], and multiple dots are allowed. There is a segment between the dots. Each segment allows letters (with no limitation on capitalization), numbers and dashes (-).
109110
* `key_ids` - (Optional, ForceNew) The key pair to use for the instance, it looks like skey-16jig7tx, it should be set if `password` not set.
110111
* `labels` - (Optional, ForceNew) Labels of tke attachment exits CVM.
111112
* `password` - (Optional, ForceNew) Password to access, should be set if `key_ids` not set.

0 commit comments

Comments
 (0)