Skip to content

Commit 6c2636b

Browse files
authored
fix(clb): [120279854] tencentcloud_clb_listener support h2c_switch params (#2939)
* add * add * add * add
1 parent 0ad5d87 commit 6c2636b

File tree

8 files changed

+155
-28
lines changed

8 files changed

+155
-28
lines changed

.changelog/2939.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 `h2c_switch` params
3+
```

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ require (
4343
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/chdfs v1.0.600
4444
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ciam v1.0.695
4545
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ckafka v1.0.748
46-
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb v1.0.984
46+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb v1.0.1034
4747
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cloudaudit v1.0.1033
4848
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls v1.0.970
4949
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1034

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -862,6 +862,8 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ckafka v1.0.748 h1:rVvR
862862
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ckafka v1.0.748/go.mod h1:nvb4W+PgsAe8NFG1ZevZa9ZLfto3aeBcJqxzYCRI9V4=
863863
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb v1.0.984 h1:uvDvC8ip75yBSUiCOIu4dGv10AKkH7M3qnmOShLZZPQ=
864864
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb v1.0.984/go.mod h1:mqn4vGnC39CHBaniEgnGQqSoVXBnIH8F+O1F5KXhbec=
865+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb v1.0.1034 h1:nZBr0eJI2iTLSm26QZXNgk4VT3Fxtt+zgXCiCH6avmo=
866+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb v1.0.1034/go.mod h1:q8fxlV0OQPmG3Zqq4f06m+EOqfU8BvZPnVsPCkCdv6E=
865867
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cloudaudit v1.0.544 h1:ApY6rS7I9otgujOdAFy0+Epno1PNVCQmsOoWQxx724Y=
866868
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cloudaudit v1.0.544/go.mod h1:c37rIdL3LrJXYwrfp9c8L4MabTqKIZUe1xvnWhN75oc=
867869
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cloudaudit v1.0.1033 h1:dIr+MVsZeUBiKZELfJh5HRJdI+BI6lCp5pv/2oXekuk=

tencentcloud/services/clb/resource_tc_clb_listener.go

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,13 @@ func ResourceTencentCloudClbListener() *schema.Resource {
242242
Optional: true,
243243
Description: "This parameter is used to specify the end port and is required when creating a port range listener. Only one member can be passed in when inputting the `Ports` parameter, which is used to specify the start port. If you want to try the port range feature, please [submit a ticket](https://console.cloud.tencent.com/workorder/category).",
244244
},
245+
"h2c_switch": {
246+
Type: schema.TypeBool,
247+
ForceNew: true,
248+
Computed: true,
249+
Optional: true,
250+
Description: "Enable H2C switch for intranet HTTP listener.",
251+
},
245252
//computed
246253
"listener_id": {
247254
Type: schema.TypeString,
@@ -350,6 +357,10 @@ func resourceTencentCloudClbListenerCreate(d *schema.ResourceData, meta interfac
350357
request.EndPort = helper.IntUint64(v.(int))
351358
}
352359

360+
if v, ok := d.GetOkExists("h2c_switch"); ok {
361+
request.H2cSwitch = helper.Bool(v.(bool))
362+
}
363+
353364
var response *clb.CreateListenerResponse
354365
err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError {
355366
result, e := meta.(tccommon.ProviderMeta).GetAPIV3Conn().UseClbClient().CreateListener(request)
@@ -518,6 +529,28 @@ func resourceTencentCloudClbListenerRead(d *schema.ResourceData, meta interface{
518529
_ = d.Set("end_port", instance.EndPort)
519530
}
520531

532+
var clbIns *clb.LoadBalancer
533+
err = resource.Retry(tccommon.ReadRetryTimeout, func() *resource.RetryError {
534+
result, e := clbService.DescribeLoadBalancerById(ctx, clbId)
535+
if e != nil {
536+
return tccommon.RetryError(e)
537+
}
538+
539+
clbIns = result
540+
return nil
541+
})
542+
543+
if err != nil {
544+
log.Printf("[CRITAL]%s read CLB instance failed, reason:%+v", logId, err)
545+
return err
546+
}
547+
548+
if clbIns.AttributeFlags != nil && len(clbIns.AttributeFlags) != 0 {
549+
_ = d.Set("h2c_switch", true)
550+
} else {
551+
_ = d.Set("h2c_switch", false)
552+
}
553+
521554
return nil
522555
}
523556

vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb/v20180317/client.go

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)