Skip to content

Commit 47855e6

Browse files
ivandksunivan
andauthored
fix the bug of replacement, and add enhancements features (#642)
* create cvm, node pool and cluster add bandwidth_package_id; create cvm add instance_count, allow to modify internet_max_bandwidth_out; create es add web_node_info_type, clb listener fix the bug of plan replacement * add timestamp with version Co-authored-by: ivan <[email protected]>
1 parent 1fd905c commit 47855e6

15 files changed

+126
-13
lines changed

CHANGELOG.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
1-
## 1.56.14 (Unreleased)
1+
## 1.56.15 (Unreleased)
2+
3+
## 1.56.14 (July 06,2021)
4+
5+
BUG FIXES
6+
7+
* Resource `tencentcloud_tc_clb_listener` exec the plan will lead the resource rebuild.
8+
9+
ENHANCEMENTS:
10+
11+
* Resource `tencentcloud_elasticsearch_instance` create **ES** cluster add new parametes of *web_node_type_info*.
12+
* Resource `tencentcloud_tc_instance` add *instance_count* to support create multiple consecutive name of instance
13+
* Resource `tencentcloud_tc_kubernetes_cluster` supports change *internet_max_bandwidth_out*
14+
* Resource `tencentcloud_tc_instance` create cvm instance add *bandwidth_package_id*
15+
216

317
## 1.56.13 (July 02, 2021)
418

tencentcloud/resource_tc_clb_listener.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,6 @@ func resourceTencentCloudClbListener() *schema.Resource {
351351
"target_type": {
352352
Type: schema.TypeString,
353353
Optional: true,
354-
ForceNew: true,
355354
ValidateFunc: validateAllowedStringValue([]string{CLB_TARGET_TYPE_NODE, CLB_TARGET_TYPE_TARGETGROUP}),
356355
Description: "Backend target type. Valid values: `NODE`, `TARGETGROUP`. `NODE` means to bind ordinary nodes, `TARGETGROUP` means to bind target group. NOTES: TCP/UDP/TCP_SSL listener must configuration, HTTP/HTTPS listener needs to be configured in tencentcloud_clb_listener_rule.",
357356
},

tencentcloud/resource_tc_elasticsearch_instance.go

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ resource "tencentcloud_elasticsearch_instance" "foo" {
1313
password = "Test12345"
1414
license_type = "oss"
1515
16+
web_node_type_info {
17+
node_num = 1
18+
node_type = "ES.S1.MEDIUM4"
19+
}
20+
1621
node_info_list {
1722
node_num = 2
1823
node_type = "ES.S1.SMALL2"
@@ -145,6 +150,25 @@ func resourceTencentCloudElasticsearchInstance() *schema.Resource {
145150
},
146151
},
147152
},
153+
"web_node_type_info": {
154+
Type: schema.TypeList,
155+
Optional: true,
156+
Description: "Visual node configuration.",
157+
Elem: &schema.Resource{
158+
Schema: map[string]*schema.Schema{
159+
"node_num": {
160+
Type: schema.TypeInt,
161+
Required: true,
162+
Description: "Visual node number.",
163+
},
164+
"node_type": {
165+
Type: schema.TypeString,
166+
Required: true,
167+
Description: "Visual node specifications.",
168+
},
169+
},
170+
},
171+
},
148172
"license_type": {
149173
Type: schema.TypeString,
150174
Optional: true,
@@ -298,6 +322,19 @@ func resourceTencentCloudElasticsearchInstanceCreate(d *schema.ResourceData, met
298322
if v, ok := d.GetOk("basic_security_type"); ok {
299323
request.BasicSecurityType = helper.IntUint64(v.(int))
300324
}
325+
if v, ok := d.GetOk("web_node_type_info"); ok {
326+
infos := v.([]interface{})
327+
for _, item := range infos {
328+
value := item.(map[string]interface{})
329+
info := &es.WebNodeTypeInfo{
330+
NodeNum: helper.IntUint64(value["node_num"].(int)),
331+
NodeType: helper.String(value["node_type"].(string)),
332+
}
333+
request.WebNodeTypeInfo = info
334+
break
335+
}
336+
}
337+
301338
if v, ok := d.GetOk("node_info_list"); ok {
302339
infos := v.([]interface{})
303340
request.NodeInfoList = make([]*es.NodeInfo, 0, len(infos))

tencentcloud/resource_tc_elasticsearch_instance_test.go

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ func TestAccTencentCloudElasticsearchInstance_basic(t *testing.T) {
2727
resource.TestCheckResourceAttr("tencentcloud_elasticsearch_instance.foo", "vpc_id", defaultVpcId),
2828
resource.TestCheckResourceAttr("tencentcloud_elasticsearch_instance.foo", "subnet_id", defaultSubnetId),
2929
resource.TestCheckResourceAttr("tencentcloud_elasticsearch_instance.foo", "license_type", "oss"),
30-
resource.TestCheckResourceAttr("tencentcloud_elasticsearch_instance.foo", "node_info_list.#", "1"),
30+
resource.TestCheckResourceAttr("tencentcloud_elasticsearch_instance.foo", "web_node_type_info.#", "1"),
31+
resource.TestCheckResourceAttr("tencentcloud_elasticsearch_instance.foo", "web_node_type_info.0.node_num", "1"),
32+
resource.TestCheckResourceAttr("tencentcloud_elasticsearch_instance.foo", "web_node_type_info.0.node_type", "ES.S1.MEDIUM4"),
3133
resource.TestCheckResourceAttr("tencentcloud_elasticsearch_instance.foo", "node_info_list.0.node_num", "2"),
3234
resource.TestCheckResourceAttr("tencentcloud_elasticsearch_instance.foo", "node_info_list.0.node_type", "ES.S1.SMALL2"),
3335
resource.TestCheckResourceAttr("tencentcloud_elasticsearch_instance.foo", "node_info_list.0.type", "hotData"),
@@ -43,6 +45,8 @@ func TestAccTencentCloudElasticsearchInstance_basic(t *testing.T) {
4345
resource.TestCheckResourceAttr("tencentcloud_elasticsearch_instance.foo", "license_type", "basic"),
4446
resource.TestCheckResourceAttr("tencentcloud_elasticsearch_instance.foo", "basic_security_type", "2"),
4547
resource.TestCheckResourceAttr("tencentcloud_elasticsearch_instance.foo", "tags.test", "test"),
48+
resource.TestCheckResourceAttr("tencentcloud_elasticsearch_instance.foo", "web_node_type_info.0.node_num", "1"),
49+
resource.TestCheckResourceAttr("tencentcloud_elasticsearch_instance.foo", "web_node_type_info.0.node_type", "ES.S1.MEDIUM8"),
4650
resource.TestCheckResourceAttr("tencentcloud_elasticsearch_instance.foo", "node_info_list.0.node_type", "ES.S1.MEDIUM8"),
4751
resource.TestCheckResourceAttr("tencentcloud_elasticsearch_instance.foo", "node_info_list.0.disk_size", "200"),
4852
),
@@ -133,6 +137,11 @@ resource "tencentcloud_elasticsearch_instance" "foo" {
133137
password = "Test1234"
134138
license_type = "oss"
135139
140+
web_node_type_info {
141+
node_num = 1
142+
node_type = "ES.S1.MEDIUM4"
143+
}
144+
136145
node_info_list {
137146
node_num = 2
138147
node_type = "ES.S1.SMALL2"
@@ -154,7 +163,12 @@ resource "tencentcloud_elasticsearch_instance" "foo" {
154163
password = "Test12345"
155164
license_type = "basic"
156165
basic_security_type = 2
157-
166+
167+
web_node_type_info {
168+
node_num = 1
169+
node_type = "ES.S1.MEDIUM8"
170+
}
171+
158172
node_info_list {
159173
node_num = 2
160174
node_type = "ES.S1.MEDIUM8"

tencentcloud/resource_tc_instance.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,13 @@ func resourceTencentCloudInstance() *schema.Resource {
176176
ForceNew: true,
177177
Description: "The available zone for the CVM instance.",
178178
},
179+
"instance_count": {
180+
Type: schema.TypeInt,
181+
Optional: true,
182+
Default: 1,
183+
ValidateFunc: validateIntegerInRange(1, 100),
184+
Description: "The number of instances to be purchased. Value range:[1,100]; default value: 1.",
185+
},
179186
"instance_name": {
180187
Type: schema.TypeString,
181188
Optional: true,
@@ -270,6 +277,11 @@ func resourceTencentCloudInstance() *schema.Resource {
270277
ValidateFunc: validateAllowedStringValue(CVM_INTERNET_CHARGE_TYPE),
271278
Description: "Internet charge type of the instance, Valid values are `BANDWIDTH_PREPAID`, `TRAFFIC_POSTPAID_BY_HOUR`, `BANDWIDTH_POSTPAID_BY_HOUR` and `BANDWIDTH_PACKAGE`. This value does not need to be set when `allocate_public_ip` is false.",
272279
},
280+
"bandwidth_package_id": {
281+
Type: schema.TypeString,
282+
Optional: true,
283+
Description: "bandwidth package id. if user is standard user, then the bandwidth_package_id is needed, or default has bandwidth_package_id.",
284+
},
273285
"internet_max_bandwidth_out": {
274286
Type: schema.TypeInt,
275287
Optional: true,
@@ -508,6 +520,9 @@ func resourceTencentCloudInstanceCreate(d *schema.ResourceData, meta interface{}
508520
if v, ok := d.GetOk("instance_name"); ok {
509521
request.InstanceName = helper.String(v.(string))
510522
}
523+
if v, ok := d.GetOk("instance_count"); ok {
524+
request.InstanceCount = helper.Int64(int64(v.(int)))
525+
}
511526
if v, ok := d.GetOk("instance_type"); ok {
512527
request.InstanceType = helper.String(v.(string))
513528
}
@@ -575,6 +590,9 @@ func resourceTencentCloudInstanceCreate(d *schema.ResourceData, meta interface{}
575590
maxBandwidthOut := int64(v.(int))
576591
request.InternetAccessible.InternetMaxBandwidthOut = &maxBandwidthOut
577592
}
593+
if v, ok := d.GetOk("bandwidth_package_id"); ok {
594+
request.InternetAccessible.BandwidthPackageId = helper.String(v.(string))
595+
}
578596
if v, ok := d.GetOkExists("allocate_public_ip"); ok {
579597
allocatePublicIp := v.(bool)
580598
request.InternetAccessible.PublicIpAssigned = &allocatePublicIp

tencentcloud/resource_tc_kubernetes_as_scaling_group.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,6 @@ func kubernetesAsScalingConfigPara() map[string]*schema.Schema {
278278
"internet_max_bandwidth_out": {
279279
Type: schema.TypeInt,
280280
Optional: true,
281-
ForceNew: true,
282281
Default: 0,
283282
Description: "Max bandwidth of Internet access in Mbps. Default is `0`.",
284283
},

tencentcloud/resource_tc_kubernetes_cluster.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,11 +473,15 @@ func TkeCvmCreateInfo() map[string]*schema.Schema {
473473
},
474474
"internet_max_bandwidth_out": {
475475
Type: schema.TypeInt,
476-
ForceNew: true,
477476
Optional: true,
478477
Default: 0,
479478
Description: "Max bandwidth of Internet access in Mbps. Default is 0.",
480479
},
480+
"bandwidth_package_id": {
481+
Type: schema.TypeString,
482+
Optional: true,
483+
Description: "bandwidth package id. if user is standard user, then the bandwidth_package_id is needed, or default has bandwidth_package_id.",
484+
},
481485
"public_ip_assigned": {
482486
Type: schema.TypeBool,
483487
ForceNew: true,
@@ -1226,6 +1230,10 @@ func tkeGetCvmRunInstancesPara(dMap map[string]interface{}, meta interface{},
12261230
request.InternetAccessible.InternetMaxBandwidthOut = helper.Int64(int64(v.(int)))
12271231
}
12281232

1233+
if v, ok := dMap["bandwidth_package_id"]; ok {
1234+
request.InternetAccessible.BandwidthPackageId = helper.String(v.(string))
1235+
}
1236+
12291237
if v, ok := dMap["public_ip_assigned"]; ok {
12301238
publicIpAssigned := v.(bool)
12311239
request.InternetAccessible.PublicIpAssigned = &publicIpAssigned

tencentcloud/resource_tc_kubernetes_node_pool.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,14 @@ func composedKubernetesAsScalingConfigPara() map[string]*schema.Schema {
175175
"internet_max_bandwidth_out": {
176176
Type: schema.TypeInt,
177177
Optional: true,
178-
ForceNew: true,
179178
Default: 0,
180179
Description: "Max bandwidth of Internet access in Mbps. Default is `0`.",
181180
},
181+
"bandwidth_package_id": {
182+
Type: schema.TypeString,
183+
Optional: true,
184+
Description: "bandwidth package id. if user is standard user, then the bandwidth_package_id is needed, or default has bandwidth_package_id.",
185+
},
182186
"public_ip_assigned": {
183187
Type: schema.TypeBool,
184188
Optional: true,
@@ -496,6 +500,9 @@ func comosedKubernetesAsScalingConfigParaSerial(dMap map[string]interface{}, met
496500
if v, ok := dMap["internet_charge_type"]; ok {
497501
request.InternetAccessible.InternetChargeType = helper.String(v.(string))
498502
}
503+
if v, ok := dMap["bandwidth_package_id"]; ok {
504+
request.InternetAccessible.BandwidthPackageId = helper.String(v.(string))
505+
}
499506
if v, ok := dMap["internet_max_bandwidth_out"]; ok {
500507
request.InternetAccessible.InternetMaxBandwidthOut = helper.IntUint64(v.(int))
501508
}

website/docs/r/clb_listener.html.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ The following arguments are supported:
179179
* `scheduler` - (Optional) Scheduling method of the CLB listener, and available values are 'WRR' and 'LEAST_CONN'. The default is 'WRR'. NOTES: The listener of `HTTP` and `HTTPS` protocol additionally supports the `IP Hash` method. NOTES: TCP/UDP/TCP_SSL listener allows direct configuration, HTTP/HTTPS listener needs to be configured in `tencentcloud_clb_listener_rule`.
180180
* `session_expire_time` - (Optional) Time of session persistence within the CLB listener. NOTES: Available when scheduler is specified as `WRR`, and not available when listener protocol is `TCP_SSL`. NOTES: TCP/UDP/TCP_SSL listener allows direct configuration, HTTP/HTTPS listener needs to be configured in `tencentcloud_clb_listener_rule`.
181181
* `sni_switch` - (Optional, ForceNew) Indicates whether SNI is enabled, and only supported with protocol `HTTPS`. If enabled, you can set a certificate for each rule in `tencentcloud_clb_listener_rule`, otherwise all rules have a certificate.
182-
* `target_type` - (Optional, ForceNew) Backend target type. Valid values: `NODE`, `TARGETGROUP`. `NODE` means to bind ordinary nodes, `TARGETGROUP` means to bind target group. NOTES: TCP/UDP/TCP_SSL listener must configuration, HTTP/HTTPS listener needs to be configured in tencentcloud_clb_listener_rule.
182+
* `target_type` - (Optional) Backend target type. Valid values: `NODE`, `TARGETGROUP`. `NODE` means to bind ordinary nodes, `TARGETGROUP` means to bind target group. NOTES: TCP/UDP/TCP_SSL listener must configuration, HTTP/HTTPS listener needs to be configured in tencentcloud_clb_listener_rule.
183183

184184
## Attributes Reference
185185

website/docs/r/elasticsearch_instance.html.markdown

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ resource "tencentcloud_elasticsearch_instance" "foo" {
2323
password = "Test12345"
2424
license_type = "oss"
2525
26+
web_node_type_info {
27+
node_num = 1
28+
node_type = "ES.S1.MEDIUM4"
29+
}
30+
2631
node_info_list {
2732
node_num = 2
2833
node_type = "ES.S1.SMALL2"
@@ -54,6 +59,7 @@ The following arguments are supported:
5459
* `multi_zone_infos` - (Optional, ForceNew) Details of AZs in multi-AZ deployment mode (which is required when deploy_mode is `1`).
5560
* `renew_flag` - (Optional, ForceNew) When enabled, the instance will be renew automatically when it reach the end of the prepaid tenancy. Valid values are `RENEW_FLAG_AUTO` and `RENEW_FLAG_MANUAL`. NOTE: it only works when charge_type is set to `PREPAID`.
5661
* `tags` - (Optional) A mapping of tags to assign to the instance. For tag limits, please refer to [Use Limits](https://intl.cloud.tencent.com/document/product/651/13354).
62+
* `web_node_type_info` - (Optional) Visual node configuration.
5763

5864
The `multi_zone_infos` object supports the following:
5965

@@ -69,6 +75,11 @@ The `node_info_list` object supports the following:
6975
* `encrypt` - (Optional) Decides to encrypt this disk or not.
7076
* `type` - (Optional) Node type. Valid values are `hotData`, `warmData` and `dedicatedMaster`. The default value is 'hotData`.
7177

78+
The `web_node_type_info` object supports the following:
79+
80+
* `node_num` - (Required) Visual node number.
81+
* `node_type` - (Required) Visual node specifications.
82+
7283
## Attributes Reference
7384

7485
In addition to all arguments above, the following attributes are exported:

0 commit comments

Comments
 (0)