Skip to content

Commit 033001b

Browse files
authored
fix(clb): [126253700] tencentcloud_clb_listener add idle_connect_timeout (#3465)
* add * add
1 parent 1c70fc2 commit 033001b

File tree

4 files changed

+37
-0
lines changed

4 files changed

+37
-0
lines changed

.changelog/3465.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
resource/tencentcloud_clb_listener: support `idle_connect_timeout`
3+
```

tencentcloud/services/clb/resource_tc_clb_listener.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,12 @@ func ResourceTencentCloudClbListener() *schema.Resource {
287287
Optional: true,
288288
Description: "Whether to send the TCP RST packet to the client when unbinding a real server. This parameter is applicable to TCP listeners only.",
289289
},
290+
"idle_connect_timeout": {
291+
Type: schema.TypeInt,
292+
Computed: true,
293+
Optional: true,
294+
Description: "Connection idle timeout period (in seconds). It's only available to TCP listeners. Value range: 300-900 for shared and dedicated instances; 300-2000 for LCU-supported CLB instances. It defaults to 900. To set a period longer than 2000 seconds (up to 3600 seconds). Please submit a work order for processing.",
295+
},
290296
//computed
291297
"listener_id": {
292298
Type: schema.TypeString,
@@ -421,6 +427,10 @@ func resourceTencentCloudClbListenerCreate(d *schema.ResourceData, meta interfac
421427
request.DeregisterTargetRst = helper.Bool(v.(bool))
422428
}
423429

430+
if v, ok := d.GetOkExists("idle_connect_timeout"); ok {
431+
request.IdleConnectTimeout = helper.IntInt64(v.(int))
432+
}
433+
424434
var response *clb.CreateListenerResponse
425435
err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError {
426436
result, e := meta.(tccommon.ProviderMeta).GetAPIV3Conn().UseClbClient().CreateListener(request)
@@ -638,6 +648,10 @@ func resourceTencentCloudClbListenerRead(d *schema.ResourceData, meta interface{
638648
_ = d.Set("deregister_target_rst", instance.DeregisterTargetRst)
639649
}
640650

651+
if instance.IdleConnectTimeout != nil {
652+
_ = d.Set("idle_connect_timeout", instance.IdleConnectTimeout)
653+
}
654+
641655
return nil
642656
}
643657

@@ -756,6 +770,13 @@ func resourceTencentCloudClbListenerUpdate(d *schema.ResourceData, meta interfac
756770
}
757771
}
758772

773+
if d.HasChange("idle_connect_timeout") {
774+
changed = true
775+
if v, ok := d.GetOkExists("idle_connect_timeout"); ok {
776+
request.IdleConnectTimeout = helper.IntInt64(v.(int))
777+
}
778+
}
779+
759780
if changed {
760781
err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError {
761782
response, e := meta.(tccommon.ProviderMeta).GetAPIV3Conn().UseClbClient().ModifyListener(request)

tencentcloud/services/clb/resource_tc_clb_listener.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ resource "tencentcloud_clb_listener" "TCP_listener" {
3333
health_check_http_code = 2
3434
health_check_http_version = "HTTP/1.0"
3535
health_check_http_method = "GET"
36+
deregister_target_rst = false
37+
idle_connect_timeout = 900
3638
}
3739
```
3840

@@ -53,6 +55,8 @@ resource "tencentcloud_clb_listener" "listener_tcp" {
5355
scheduler = "WRR"
5456
health_check_type = "TCP"
5557
health_check_port = 200
58+
deregister_target_rst = false
59+
idle_connect_timeout = 900
5660
}
5761
```
5862

@@ -77,6 +81,8 @@ resource "tencentcloud_clb_listener" "listener_tcp" {
7781
health_check_http_version = "HTTP/1.1"
7882
health_check_http_method = "HEAD"
7983
health_check_http_path = "/"
84+
deregister_target_rst = false
85+
idle_connect_timeout = 900
8086
}
8187
```
8288

website/docs/r/clb_listener.html.markdown

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ resource "tencentcloud_clb_listener" "TCP_listener" {
4444
health_check_http_code = 2
4545
health_check_http_version = "HTTP/1.0"
4646
health_check_http_method = "GET"
47+
deregister_target_rst = false
48+
idle_connect_timeout = 900
4749
}
4850
```
4951

@@ -64,6 +66,8 @@ resource "tencentcloud_clb_listener" "listener_tcp" {
6466
scheduler = "WRR"
6567
health_check_type = "TCP"
6668
health_check_port = 200
69+
deregister_target_rst = false
70+
idle_connect_timeout = 900
6771
}
6872
```
6973

@@ -88,6 +92,8 @@ resource "tencentcloud_clb_listener" "listener_tcp" {
8892
health_check_http_version = "HTTP/1.1"
8993
health_check_http_method = "HEAD"
9094
health_check_http_path = "/"
95+
deregister_target_rst = false
96+
idle_connect_timeout = 900
9197
}
9298
```
9399

@@ -219,6 +225,7 @@ The following arguments are supported:
219225
* `health_check_type` - (Optional, String) Protocol used for health check. Valid values: `CUSTOM`, `TCP`, `HTTP`,`HTTPS`, `PING`, `GRPC`.
220226
* `health_check_unhealth_num` - (Optional, Int) Unhealthy threshold of health check, and the default is `3`. If a success result is returned for the health check 3 consecutive times, the CVM is identified as unhealthy. The value range is [2-10]. NOTES: TCP/UDP/TCP_SSL listener allows direct configuration, HTTP/HTTPS listener needs to be configured in `tencentcloud_clb_listener_rule`.
221227
* `health_source_ip_type` - (Optional, Int) Specifies the type of health check source IP. `0` (default): CLB VIP. `1`: 100.64 IP range.
228+
* `idle_connect_timeout` - (Optional, Int) Connection idle timeout period (in seconds). It's only available to TCP listeners. Value range: 300-900 for shared and dedicated instances; 300-2000 for LCU-supported CLB instances. It defaults to 900. To set a period longer than 2000 seconds (up to 3600 seconds). Please submit a work order for processing.
222229
* `keepalive_enable` - (Optional, Int) Whether to enable a persistent connection. This parameter is applicable only to HTTP and HTTPS listeners. Valid values: 0 (disable; default value) and 1 (enable).
223230
* `multi_cert_info` - (Optional, List) Certificate information. You can specify multiple server-side certificates with different algorithm types. This parameter is only applicable to HTTPS listeners with the SNI feature not enabled. Certificate and MultiCertInfo cannot be specified at the same time.
224231
* `port` - (Optional, Int, ForceNew) Port of the CLB listener.

0 commit comments

Comments
 (0)