Skip to content

fix(clb): [120279854] tencentcloud_clb_listener support h2c_switch params #2939

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/2939.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/tencentcloud_clb_listener: support `h2c_switch` params
```
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ require (
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/chdfs v1.0.600
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ciam v1.0.695
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ckafka v1.0.748
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb v1.0.984
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb v1.0.1034
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cloudaudit v1.0.1033
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls v1.0.970
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1033
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1034
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm v1.0.1014
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cwp v1.0.762
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cynosdb v1.0.692
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,8 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ckafka v1.0.748 h1:rVvR
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ckafka v1.0.748/go.mod h1:nvb4W+PgsAe8NFG1ZevZa9ZLfto3aeBcJqxzYCRI9V4=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb v1.0.984 h1:uvDvC8ip75yBSUiCOIu4dGv10AKkH7M3qnmOShLZZPQ=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb v1.0.984/go.mod h1:mqn4vGnC39CHBaniEgnGQqSoVXBnIH8F+O1F5KXhbec=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb v1.0.1034 h1:nZBr0eJI2iTLSm26QZXNgk4VT3Fxtt+zgXCiCH6avmo=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb v1.0.1034/go.mod h1:q8fxlV0OQPmG3Zqq4f06m+EOqfU8BvZPnVsPCkCdv6E=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cloudaudit v1.0.544 h1:ApY6rS7I9otgujOdAFy0+Epno1PNVCQmsOoWQxx724Y=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cloudaudit v1.0.544/go.mod h1:c37rIdL3LrJXYwrfp9c8L4MabTqKIZUe1xvnWhN75oc=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cloudaudit v1.0.1033 h1:dIr+MVsZeUBiKZELfJh5HRJdI+BI6lCp5pv/2oXekuk=
Expand Down Expand Up @@ -949,6 +951,8 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1031 h1:3ou
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1031/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1033 h1:g263/dapUpOAZJa1Y9x07WgfOl7Yy+FM5Mrf4WyttS8=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1033/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1034 h1:T7ewuO2DD+5R2LRpD2kTRy25aCkVDVdYkmmyUS63i08=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1034/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/controlcenter v1.0.993 h1:WlPgXldQCxt7qi5Xrc6j6zTrsXWzN5BcOGs7Irq7fwQ=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/controlcenter v1.0.993/go.mod h1:Z9U8zNtyuyKhjS0698wqsrG/kLx1TQ5CEixXBwVe7xY=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/csip v1.0.860 h1:F3esKBIT3HW9+7Gt8cVgf8X06VdGIczpgLBUECzSEzU=
Expand Down
33 changes: 33 additions & 0 deletions tencentcloud/services/clb/resource_tc_clb_listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,13 @@ func ResourceTencentCloudClbListener() *schema.Resource {
Optional: true,
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).",
},
"h2c_switch": {
Type: schema.TypeBool,
ForceNew: true,
Computed: true,
Optional: true,
Description: "Enable H2C switch for intranet HTTP listener.",
},
//computed
"listener_id": {
Type: schema.TypeString,
Expand Down Expand Up @@ -350,6 +357,10 @@ func resourceTencentCloudClbListenerCreate(d *schema.ResourceData, meta interfac
request.EndPort = helper.IntUint64(v.(int))
}

if v, ok := d.GetOkExists("h2c_switch"); ok {
request.H2cSwitch = helper.Bool(v.(bool))
}

var response *clb.CreateListenerResponse
err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError {
result, e := meta.(tccommon.ProviderMeta).GetAPIV3Conn().UseClbClient().CreateListener(request)
Expand Down Expand Up @@ -518,6 +529,28 @@ func resourceTencentCloudClbListenerRead(d *schema.ResourceData, meta interface{
_ = d.Set("end_port", instance.EndPort)
}

var clbIns *clb.LoadBalancer
err = resource.Retry(tccommon.ReadRetryTimeout, func() *resource.RetryError {
result, e := clbService.DescribeLoadBalancerById(ctx, clbId)
if e != nil {
return tccommon.RetryError(e)
}

clbIns = result
return nil
})

if err != nil {
log.Printf("[CRITAL]%s read CLB instance failed, reason:%+v", logId, err)
return err
}

if clbIns.AttributeFlags != nil && len(clbIns.AttributeFlags) != 0 {
_ = d.Set("h2c_switch", true)
} else {
_ = d.Set("h2c_switch", false)
}

return nil
}

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading