Skip to content

Commit f72a84d

Browse files
authored
support clb listener rule (#1590)
* support clb listener rule * add changelog
1 parent 279b8fb commit f72a84d

File tree

4 files changed

+25
-2
lines changed

4 files changed

+25
-2
lines changed

.changelog/1590.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_rule: support `health_check_type` and `health_check_time_out`
3+
```

tencentcloud/resource_tc_clb_listener_rule.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,20 @@ func resourceTencentCloudClbListenerRule() *schema.Resource {
108108
ValidateFunc: validateIntegerInRange(2, 10),
109109
Description: "Unhealthy threshold of health check, and the default is `3`. If the unhealthy result is returned 3 consecutive times, indicates that the forwarding is abnormal. 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`.",
110110
},
111+
"health_check_type": {
112+
Type: schema.TypeString,
113+
Optional: true,
114+
Computed: true,
115+
ValidateFunc: validateAllowedStringValue(HEALTH_CHECK_TYPE),
116+
Description: "Type of health check. Valid value is `CUSTOM`, `TCP`, `HTTP`.",
117+
},
118+
"health_check_time_out": {
119+
Type: schema.TypeInt,
120+
Optional: true,
121+
Computed: true,
122+
ValidateFunc: validateIntegerInRange(2, 60),
123+
Description: "Time out of health check. The value range is [2-60](SEC).",
124+
},
111125
"health_check_http_code": {
112126
Type: schema.TypeInt,
113127
Optional: true,
@@ -437,6 +451,8 @@ func resourceTencentCloudClbListenerRuleRead(d *schema.ResourceData, meta interf
437451
_ = d.Set("health_check_http_domain", instance.HealthCheck.HttpCheckDomain)
438452
_ = d.Set("health_check_http_path", instance.HealthCheck.HttpCheckPath)
439453
_ = d.Set("health_check_http_code", instance.HealthCheck.HttpCode)
454+
_ = d.Set("health_check_type", instance.HealthCheck.CheckType)
455+
_ = d.Set("health_check_time_out", instance.HealthCheck.TimeOut)
440456
}
441457

442458
if instance.Certificate != nil {

tencentcloud/resource_tc_clb_listener_rule_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"github.com/hashicorp/terraform-plugin-sdk/terraform"
1111
)
1212

13-
func TestAccTencentCloudClbListenerRule_basic(t *testing.T) {
13+
func TestAccTencentCloudClbListenerRuleResource_basic(t *testing.T) {
1414
t.Parallel()
1515

1616
resource.Test(t, resource.TestCase{
@@ -54,7 +54,7 @@ func TestAccTencentCloudClbListenerRule_basic(t *testing.T) {
5454
})
5555
}
5656

57-
func TestAccTencentCloudClbListenerRule_full(t *testing.T) {
57+
func TestAccTencentCloudClbListenerRuleResource_full(t *testing.T) {
5858
t.Parallel()
5959

6060
resource.Test(t, resource.TestCase{
@@ -286,6 +286,8 @@ resource "tencentcloud_clb_listener_rule" "rule_full" {
286286
health_check_interval_time = 300
287287
health_check_health_num = 6
288288
health_check_unhealth_num = 6
289+
health_check_time_out = 4
290+
health_check_type = "TCP"
289291
health_check_http_path = "/"
290292
health_check_http_domain = "abcd.com"
291293
health_check_http_code = "1"

website/docs/r/clb_listener_rule.html.markdown

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ The following arguments are supported:
5656
* `health_check_http_path` - (Optional, String) Path of health check. NOTES: Only supports listeners of `HTTP` and `HTTPS` protocol.
5757
* `health_check_interval_time` - (Optional, Int) Interval time of health check. Valid value ranges: (5~300) sec. and the default is `5` sec. NOTES: TCP/UDP/TCP_SSL listener allows direct configuration, HTTP/HTTPS listener needs to be configured in `tencentcloud_clb_listener_rule`.
5858
* `health_check_switch` - (Optional, Bool) Indicates whether health check is enabled.
59+
* `health_check_time_out` - (Optional, Int) Time out of health check. The value range is [2-60](SEC).
60+
* `health_check_type` - (Optional, String) Type of health check. Valid value is `CUSTOM`, `TCP`, `HTTP`.
5961
* `health_check_unhealth_num` - (Optional, Int) Unhealthy threshold of health check, and the default is `3`. If the unhealthy result is returned 3 consecutive times, indicates that the forwarding is abnormal. 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`.
6062
* `http2_switch` - (Optional, Bool) Indicate to apply HTTP2.0 protocol or not.
6163
* `scheduler` - (Optional, String) Scheduling method of the CLB listener rules. Valid values: `WRR`, `IP HASH`, `LEAST_CONN`. The default is `WRR`. NOTES: TCP/UDP/TCP_SSL listener allows direct configuration, HTTP/HTTPS listener needs to be configured in `tencentcloud_clb_listener_rule`.

0 commit comments

Comments
 (0)