Skip to content

fix(clb): [125554409] tencentcloud_clb_attachment optmize targets code #3434

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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/3434.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/tencentcloud_clb_attachment: optmize `targets` code
```
3 changes: 1 addition & 2 deletions tencentcloud/services/clb/resource_tc_clb_attachment.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,7 @@ 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 || *onlineTarget.Type == CLB_BACKEND_TYPE_SRV {
} else {
target := map[string]interface{}{
"weight": int(*onlineTarget.Weight),
"port": int(*onlineTarget.Port),
Expand Down
14 changes: 8 additions & 6 deletions tencentcloud/services/clb/resource_tc_clb_attachment.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Provides a resource to create a CLB attachment.

Example Usage

Bind a Cvm instance by using `rule_id`
Bind a Cvm instance by using rule_id

```hcl
resource "tencentcloud_clb_attachment" "example" {
Expand All @@ -20,7 +20,7 @@ resource "tencentcloud_clb_attachment" "example" {
}
```

Bind a Cvm instance by using `domian` and `url`
Bind a Cvm instance by using domian and url

```hcl
resource "tencentcloud_clb_attachment" "example" {
Expand All @@ -37,7 +37,7 @@ resource "tencentcloud_clb_attachment" "example" {
}
```

Bind multiple Cvm instances by using `rule_id`
Bind multiple Cvm instances by using rule_id

```hcl
resource "tencentcloud_clb_attachment" "example" {
Expand All @@ -59,7 +59,7 @@ resource "tencentcloud_clb_attachment" "example" {
}
```

Bind multiple Cvm instances by using `domian` and `url`
Bind multiple Cvm instances by using domian and url

```hcl
resource "tencentcloud_clb_attachment" "example" {
Expand All @@ -82,7 +82,7 @@ resource "tencentcloud_clb_attachment" "example" {
}
```

Bind backend target is ENI by using `rule_id`
Bind backend target is ENI by using rule_id

```hcl
resource "tencentcloud_clb_attachment" "example" {
Expand All @@ -98,7 +98,7 @@ resource "tencentcloud_clb_attachment" "example" {
}
```

Bind backend target is ENI by using `domian` and `url`
Bind backend target is ENI by using domian and url

```hcl
resource "tencentcloud_clb_attachment" "example" {
Expand All @@ -121,8 +121,10 @@ CLB attachment can be imported using the id, e.g.

```
$ terraform import tencentcloud_clb_attachment.example loc-4xxr2cy7#lbl-hh141sn9#lb-7a0t6zqb
```

Or

```
$ terraform import tencentcloud_clb_attachment.example test.com,/#lbl-hh141sn9#lb-7a0t6zqb
```
14 changes: 9 additions & 5 deletions website/docs/r/clb_attachment.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ Provides a resource to create a CLB attachment.

## Example Usage

### Bind a Cvm instance by using rule_id

```hcl
resource "tencentcloud_clb_attachment" "example" {
clb_id = "lb-k2zjp9lv"
Expand All @@ -29,7 +31,7 @@ resource "tencentcloud_clb_attachment" "example" {
}
```


### Bind a Cvm instance by using domian and url

```hcl
resource "tencentcloud_clb_attachment" "example" {
Expand All @@ -46,7 +48,7 @@ resource "tencentcloud_clb_attachment" "example" {
}
```


### Bind multiple Cvm instances by using rule_id

```hcl
resource "tencentcloud_clb_attachment" "example" {
Expand All @@ -68,7 +70,7 @@ resource "tencentcloud_clb_attachment" "example" {
}
```


### Bind multiple Cvm instances by using domian and url

```hcl
resource "tencentcloud_clb_attachment" "example" {
Expand All @@ -91,7 +93,7 @@ resource "tencentcloud_clb_attachment" "example" {
}
```


### Bind backend target is ENI by using rule_id

```hcl
resource "tencentcloud_clb_attachment" "example" {
Expand All @@ -107,7 +109,7 @@ resource "tencentcloud_clb_attachment" "example" {
}
```


### Bind backend target is ENI by using domian and url

```hcl
resource "tencentcloud_clb_attachment" "example" {
Expand Down Expand Up @@ -156,9 +158,11 @@ CLB attachment can be imported using the id, e.g.

```
$ terraform import tencentcloud_clb_attachment.example loc-4xxr2cy7#lbl-hh141sn9#lb-7a0t6zqb
```

Or

```
$ terraform import tencentcloud_clb_attachment.example test.com,/#lbl-hh141sn9#lb-7a0t6zqb
```

Loading