Skip to content

Commit c06f486

Browse files
author
“guojunchu”
committed
fix datasource target_groups
1 parent 2bc2e20 commit c06f486

File tree

3 files changed

+20
-17
lines changed

3 files changed

+20
-17
lines changed

tencentcloud/data_source_tc_clb_target_groups.go

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,19 @@ resource "tencentcloud_clb_listener_rule" "rule_basic" {
2626
target_type = "TARGETGROUP"
2727
}
2828
29-
resource "tencentcloud_clb_targetgroup" "test"{
29+
resource "tencentcloud_clb_target_group" "test"{
3030
target_group_name = "test-target-keep-1"
3131
}
3232
3333
resource "tencentcloud_clb_target_group_attachment" "group" {
3434
clb_id = tencentcloud_clb_instance.clb_basic.id
3535
listener_id = tencentcloud_clb_listener.listener_basic.id
3636
rule_id = tencentcloud_clb_listener_rule.rule_basic.id
37-
targrt_group_id = tencentcloud_clb_targetgroup.test.id
37+
targrt_group_id = tencentcloud_clb_target_group.test.id
3838
}
3939
4040
data "tencentcloud_clb_target_groups" "target_group_info_id" {
41-
target_group_id = tencentcloud_clb_targetgroup.test.id
41+
target_group_id = tencentcloud_clb_target_group.test.id
4242
}
4343
```
4444
*/
@@ -63,17 +63,20 @@ func dataSourceTencentCloudClbTargetGroups() *schema.Resource {
6363
Type: schema.TypeString,
6464
Optional: true,
6565
ConflictsWith: []string{"vpc_id", "target_group_name"},
66+
AtLeastOneOf: []string{"vpc_id", "target_group_name"},
6667
Description: "ID of Target group. Mutually exclusive with 'vpc_id' and 'target_group_name'. 'target_group_id' is preferred.",
6768
},
6869
"vpc_id": {
69-
Type: schema.TypeString,
70-
Optional: true,
71-
Description: "Target group VPC ID. Mutually exclusive with 'target_group_id'. 'target_group_id' is preferred.",
70+
Type: schema.TypeString,
71+
Optional: true,
72+
AtLeastOneOf: []string{"target_group_id", "target_group_name"},
73+
Description: "Target group VPC ID. Mutually exclusive with 'target_group_id'. 'target_group_id' is preferred.",
7274
},
7375
"target_group_name": {
74-
Type: schema.TypeString,
75-
Optional: true,
76-
Description: "Name of target group. Mutually exclusive with 'target_group_id'. 'target_group_id' is preferred.",
76+
Type: schema.TypeString,
77+
Optional: true,
78+
AtLeastOneOf: []string{"target_group_id", "vpc_id"},
79+
Description: "Name of target group. Mutually exclusive with 'target_group_id'. 'target_group_id' is preferred.",
7780
},
7881
"result_output_file": {
7982
Type: schema.TypeString,

tencentcloud/data_source_tc_clb_target_groups_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
const (
1010
targetGroupById = "data.tencentcloud_clb_target_groups.target_group_info_id"
1111
targetGroupByName = "data.tencentcloud_clb_target_groups.target_group_info_name"
12-
targetGroupResource = "tencentcloud_clb_targetgroup.test"
12+
targetGroupResource = "tencentcloud_clb_target_group.test"
1313
)
1414

1515
func TestAccTencentCloudDataSourceClbTargetGroup(t *testing.T) {
@@ -75,26 +75,26 @@ resource "tencentcloud_clb_listener_rule" "rule_basic" {
7575
target_type = "TARGETGROUP"
7676
}
7777
78-
resource "tencentcloud_clb_targetgroup" "test"{
78+
resource "tencentcloud_clb_target_group" "test"{
7979
target_group_name = "test-target-keep-1"
8080
}
8181
8282
resource "tencentcloud_clb_target_group_attachment" "group" {
8383
clb_id = tencentcloud_clb_instance.clb_basic.id
8484
listener_id = tencentcloud_clb_listener.listener_basic.id
8585
rule_id = tencentcloud_clb_listener_rule.rule_basic.id
86-
targrt_group_id = tencentcloud_clb_targetgroup.test.id
86+
targrt_group_id = tencentcloud_clb_target_group.test.id
8787
}
8888
`
8989

9090
const testAccTencentCloudDataSourceClbTargetGroup = tareGetGroupBase + `
9191
data "tencentcloud_clb_target_groups" "target_group_info_id" {
92-
target_group_id = tencentcloud_clb_targetgroup.test.id
92+
target_group_id = tencentcloud_clb_target_group.test.id
9393
}
9494
`
9595

9696
const testAccTencentCloudDataSourceClbTargetGroupName = tareGetGroupBase + `
9797
data "tencentcloud_clb_target_groups" "target_group_info_name" {
98-
target_group_name = tencentcloud_clb_targetgroup.test.target_group_name
98+
target_group_name = tencentcloud_clb_target_group.test.target_group_name
9999
}
100100
`

website/docs/d/clb_target_groups.html.markdown

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,19 @@ resource "tencentcloud_clb_listener_rule" "rule_basic" {
3636
target_type = "TARGETGROUP"
3737
}
3838
39-
resource "tencentcloud_clb_targetgroup" "test" {
39+
resource "tencentcloud_clb_target_group" "test" {
4040
target_group_name = "test-target-keep-1"
4141
}
4242
4343
resource "tencentcloud_clb_target_group_attachment" "group" {
4444
clb_id = tencentcloud_clb_instance.clb_basic.id
4545
listener_id = tencentcloud_clb_listener.listener_basic.id
4646
rule_id = tencentcloud_clb_listener_rule.rule_basic.id
47-
targrt_group_id = tencentcloud_clb_targetgroup.test.id
47+
targrt_group_id = tencentcloud_clb_target_group.test.id
4848
}
4949
5050
data "tencentcloud_clb_target_groups" "target_group_info_id" {
51-
target_group_id = tencentcloud_clb_targetgroup.test.id
51+
target_group_id = tencentcloud_clb_target_group.test.id
5252
}
5353
```
5454

0 commit comments

Comments
 (0)