Skip to content

fix(clb): [119519507] tencentcloud_clb_attachment Adapt to SRV type for targets params #2806

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 2 commits into from
Sep 4, 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/2806.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/tencentcloud_clb_attachment: support `SRV` type
```
1 change: 1 addition & 0 deletions tencentcloud/services/clb/extension_clb.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ const (
CLB_BACKEND_TYPE_ENI = "ENI"
CLB_BACKEND_TYPE_NAT = "NAT"
CLB_BACKEND_TYPE_CCN = "CCN"
CLB_BACKEND_TYPE_SRV = "SRV"
)

const (
Expand Down
18 changes: 2 additions & 16 deletions tencentcloud/services/clb/resource_tc_clb_attachment.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,8 @@ func resourceTencentCloudClbServerAttachmentRead(d *schema.ResourceData, meta in
}

targets = append(targets, target)
} else if *onlineTarget.Type == CLB_BACKEND_TYPE_ENI || *onlineTarget.Type == CLB_BACKEND_TYPE_NAT || *onlineTarget.Type == CLB_BACKEND_TYPE_CCN {
} else if *onlineTarget.Type == CLB_BACKEND_TYPE_ENI || *onlineTarget.Type == CLB_BACKEND_TYPE_NAT ||
*onlineTarget.Type == CLB_BACKEND_TYPE_CCN || *onlineTarget.Type == CLB_BACKEND_TYPE_SRV {
target := map[string]interface{}{
"weight": int(*onlineTarget.Weight),
"port": int(*onlineTarget.Port),
Expand All @@ -306,21 +307,6 @@ func resourceTencentCloudClbServerAttachmentRead(d *schema.ResourceData, meta in

_ = d.Set("targets", targets)

err = resource.Retry(tccommon.ReadRetryTimeout, func() *resource.RetryError {
result, e := clbService.DescribeTargetsByPara(ctx, clbId, listenerId, locationId)
if e != nil {
return tccommon.RetryError(e)
}

instance = result
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里为什么要去掉?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

冗余代码 无意义

return nil
})

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

return nil
}

Expand Down
Loading