Skip to content

Commit 5e6a6b5

Browse files
authored
fix/clb (#2003)
* fix/clb * fix/clb * fix/clb
1 parent 127da20 commit 5e6a6b5

File tree

8 files changed

+24
-11
lines changed

8 files changed

+24
-11
lines changed

.changelog/2003.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
data_source/tencentcloud_clb_attachments: Optimize the problem display of target parameters
3+
```

tencentcloud/data_source_tc_clb_attachments.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,8 @@ func dataSourceTencentCloudClbServerAttachmentsRead(d *schema.ResourceData, meta
165165
}
166166
}
167167
}
168-
} else if *attachment.Protocol == CLB_LISTENER_PROTOCOL_TCP || *attachment.Protocol == CLB_LISTENER_PROTOCOL_UDP {
168+
} else if *attachment.Protocol == CLB_LISTENER_PROTOCOL_TCP || *attachment.Protocol == CLB_LISTENER_PROTOCOL_UDP ||
169+
*attachment.Protocol == CLB_LISTENER_PROTOCOL_TCPSSL || *attachment.Protocol == CLB_LISTENER_PROTOCOL_QUIC {
169170
mapping["targets"] = flattenBackendList(attachment.Targets)
170171
}
171172
attachmentList = append(attachmentList, mapping)

tencentcloud/extension_clb.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const (
1616
CLB_LISTENER_PROTOCOL_HTTP = "HTTP"
1717
CLB_LISTENER_PROTOCOL_HTTPS = "HTTPS"
1818
CLB_LISTENER_PROTOCOL_TCPSSL = "TCP_SSL"
19+
CLB_LISTENER_PROTOCOL_QUIC = "QUIC"
1920
)
2021

2122
var CLB_LISTENER_PROTOCOL = []string{
@@ -24,6 +25,7 @@ var CLB_LISTENER_PROTOCOL = []string{
2425
CLB_LISTENER_PROTOCOL_HTTP,
2526
CLB_LISTENER_PROTOCOL_HTTPS,
2627
CLB_LISTENER_PROTOCOL_TCPSSL,
28+
CLB_LISTENER_PROTOCOL_QUIC,
2729
}
2830

2931
const (

tencentcloud/resource_tc_alb_server_attachment.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,8 @@ func resourceTencentCloudAlbServerAttachmentRead(d *schema.ResourceData, meta in
215215
}
216216
}
217217
}
218-
} else if *instance.Protocol == CLB_LISTENER_PROTOCOL_TCP || *instance.Protocol == CLB_LISTENER_PROTOCOL_UDP {
218+
} else if *instance.Protocol == CLB_LISTENER_PROTOCOL_TCP || *instance.Protocol == CLB_LISTENER_PROTOCOL_UDP ||
219+
*instance.Protocol == CLB_LISTENER_PROTOCOL_TCPSSL || *instance.Protocol == CLB_LISTENER_PROTOCOL_QUIC {
219220
_ = d.Set("backends", flattenBackendList(instance.Targets))
220221
}
221222

tencentcloud/resource_tc_clb_listener.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ func resourceTencentCloudClbListener() *schema.Resource {
196196
Required: true,
197197
ForceNew: true,
198198
ValidateFunc: validateAllowedStringValue(CLB_LISTENER_PROTOCOL),
199-
Description: "Type of protocol within the listener. Valid values: `TCP`, `UDP`, `HTTP`, `HTTPS` and `TCP_SSL`.",
199+
Description: "Type of protocol within the listener. Valid values: `TCP`, `UDP`, `HTTP`, `HTTPS`, `TCP_SSL` and `QUIC`.",
200200
},
201201
"health_check_switch": {
202202
Type: schema.TypeBool,
@@ -420,7 +420,8 @@ func resourceTencentCloudClbListenerCreate(d *schema.ResourceData, meta interfac
420420
if v, ok := d.GetOk("target_type"); ok {
421421
targetType := v.(string)
422422
request.TargetType = &targetType
423-
} else if protocol == CLB_LISTENER_PROTOCOL_TCP || protocol == CLB_LISTENER_PROTOCOL_UDP || protocol == CLB_LISTENER_PROTOCOL_TCPSSL {
423+
} else if protocol == CLB_LISTENER_PROTOCOL_TCP || protocol == CLB_LISTENER_PROTOCOL_UDP ||
424+
protocol == CLB_LISTENER_PROTOCOL_TCPSSL || protocol == CLB_LISTENER_PROTOCOL_QUIC {
424425
targetType := CLB_TARGET_TYPE_NODE
425426
request.TargetType = &targetType
426427
}
@@ -540,7 +541,8 @@ func resourceTencentCloudClbListenerRead(d *schema.ResourceData, meta interface{
540541
if instance.SessionExpireTime != nil {
541542
_ = d.Set("session_expire_time", instance.SessionExpireTime)
542543
}
543-
if *instance.Protocol == CLB_LISTENER_PROTOCOL_TCP || *instance.Protocol == CLB_LISTENER_PROTOCOL_TCPSSL || *instance.Protocol == CLB_LISTENER_PROTOCOL_UDP {
544+
if *instance.Protocol == CLB_LISTENER_PROTOCOL_TCP || *instance.Protocol == CLB_LISTENER_PROTOCOL_TCPSSL ||
545+
*instance.Protocol == CLB_LISTENER_PROTOCOL_UDP || *instance.Protocol == CLB_LISTENER_PROTOCOL_QUIC {
544546
_ = d.Set("scheduler", instance.Scheduler)
545547
}
546548
_ = d.Set("sni_switch", *instance.SniSwitch > 0)
@@ -638,8 +640,9 @@ func resourceTencentCloudClbListenerUpdate(d *schema.ResourceData, meta interfac
638640
if d.HasChange("scheduler") {
639641
changed = true
640642
scheduler = d.Get("scheduler").(string)
641-
if !(protocol == CLB_LISTENER_PROTOCOL_TCP || protocol == CLB_LISTENER_PROTOCOL_UDP || protocol == CLB_LISTENER_PROTOCOL_TCPSSL) {
642-
return fmt.Errorf("[CHECK][CLB listener %s][Update] check: Scheduler can only be set with listener protocol TCP/UDP/TCP_SSL or rule of listener HTTP/HTTPS", listenerId)
643+
if !(protocol == CLB_LISTENER_PROTOCOL_TCP || protocol == CLB_LISTENER_PROTOCOL_UDP ||
644+
protocol == CLB_LISTENER_PROTOCOL_TCPSSL || protocol == CLB_LISTENER_PROTOCOL_QUIC) {
645+
return fmt.Errorf("[CHECK][CLB listener %s][Update] check: Scheduler can only be set with listener protocol TCP/UDP/TCP_SSL/QUIC or rule of listener HTTP/HTTPS", listenerId)
643646
}
644647
if scheduler == CLB_LISTENER_SCHEDULER_IP_HASH {
645648
return fmt.Errorf("[CHECK][CLB listener %s][Update] check: Scheduler 'IP_HASH' can only be set with rule of listener HTTP/HTTPS", listenerId)

tencentcloud/resource_tc_clb_target_group_attachment.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,8 @@ func resourceTencentCloudClbTargetGroupAttachmentDelete(d *schema.ResourceData,
273273
if rule.LocationId != nil {
274274
originLocationId = *rule.LocationId
275275
}
276-
if *rule.Protocol == CLB_LISTENER_PROTOCOL_TCP || *rule.Protocol == CLB_LISTENER_PROTOCOL_UDP || *rule.Protocol == CLB_LISTENER_PROTOCOL_TCPSSL {
276+
if *rule.Protocol == CLB_LISTENER_PROTOCOL_TCP || *rule.Protocol == CLB_LISTENER_PROTOCOL_UDP ||
277+
*rule.Protocol == CLB_LISTENER_PROTOCOL_TCPSSL || *rule.Protocol == CLB_LISTENER_PROTOCOL_QUIC {
277278
if originListenerId == ids[1] && originClbId == ids[2] {
278279
return resource.RetryableError(
279280
fmt.Errorf("rule association target group instance still exist. [targetGroupId=%s, listenerId=%s, cldId=%s]",

tencentcloud/service_tencentcloud_clb.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -900,7 +900,8 @@ func checkHealthCheckPara(ctx context.Context, d *schema.ResourceData, protocol
900900

901901
if healthSetFlag {
902902
if !(((protocol == CLB_LISTENER_PROTOCOL_TCP || protocol == CLB_LISTENER_PROTOCOL_UDP ||
903-
protocol == CLB_LISTENER_PROTOCOL_TCPSSL) && applyType == HEALTH_APPLY_TYPE_LISTENER) ||
903+
protocol == CLB_LISTENER_PROTOCOL_TCPSSL || protocol == CLB_LISTENER_PROTOCOL_QUIC) &&
904+
applyType == HEALTH_APPLY_TYPE_LISTENER) ||
904905
((protocol == CLB_LISTENER_PROTOCOL_HTTP || protocol == CLB_LISTENER_PROTOCOL_HTTPS) &&
905906
applyType == HEALTH_APPLY_TYPE_RULE)) {
906907
healthSetFlag = false
@@ -1342,7 +1343,8 @@ func (me *ClbService) DescribeAssociateTargetGroups(ctx context.Context, ids []s
13421343
originLocationId = *rule.LocationId
13431344
}
13441345

1345-
if *rule.Protocol == CLB_LISTENER_PROTOCOL_TCP || *rule.Protocol == CLB_LISTENER_PROTOCOL_UDP || *rule.Protocol == CLB_LISTENER_PROTOCOL_TCPSSL {
1346+
if *rule.Protocol == CLB_LISTENER_PROTOCOL_TCP || *rule.Protocol == CLB_LISTENER_PROTOCOL_UDP ||
1347+
*rule.Protocol == CLB_LISTENER_PROTOCOL_TCPSSL || *rule.Protocol == CLB_LISTENER_PROTOCOL_QUIC {
13461348
if originListenerId == ids[1] && originClbId == ids[2] {
13471349
return true, nil
13481350
}

website/docs/r/clb_listener.html.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ The following arguments are supported:
156156

157157
* `clb_id` - (Required, String, ForceNew) ID of the CLB.
158158
* `listener_name` - (Required, String) Name of the CLB listener, and available values can only be Chinese characters, English letters, numbers, underscore and hyphen '-'.
159-
* `protocol` - (Required, String, ForceNew) Type of protocol within the listener. Valid values: `TCP`, `UDP`, `HTTP`, `HTTPS` and `TCP_SSL`.
159+
* `protocol` - (Required, String, ForceNew) Type of protocol within the listener. Valid values: `TCP`, `UDP`, `HTTP`, `HTTPS`, `TCP_SSL` and `QUIC`.
160160
* `certificate_ca_id` - (Optional, String) ID of the client certificate. NOTES: Only supports listeners of `HTTPS` and `TCP_SSL` protocol and must be set when the ssl mode is `MUTUAL`.
161161
* `certificate_id` - (Optional, String) ID of the server certificate. NOTES: Only supports listeners of `HTTPS` and `TCP_SSL` protocol and must be set when it is available.
162162
* `certificate_ssl_mode` - (Optional, String) Type of certificate. Valid values: `UNIDIRECTIONAL`, `MUTUAL`. NOTES: Only supports listeners of `HTTPS` and `TCP_SSL` protocol and must be set when it is available.

0 commit comments

Comments
 (0)