@@ -28,6 +28,38 @@ func TestAccTencentCloudClbTargetGroup_basic(t *testing.T) {
2828 })
2929}
3030
31+ func TestAccTencentCloudClbInstanceTargetGroup (t * testing.T ) {
32+ t .Parallel ()
33+
34+ resource .Test (t , resource.TestCase {
35+ PreCheck : func () { testAccPreCheck (t ) },
36+ Providers : testAccProviders ,
37+ CheckDestroy : testAccCheckClbInstanceDestroy ,
38+ Steps : []resource.TestStep {
39+ {
40+ Config : testAccClbInstanceTargetGroup ,
41+ Check : resource .ComposeTestCheckFunc (
42+ testAccCheckClbInstanceExists ("tencentcloud_clb_instance.target_group" ),
43+ resource .TestCheckResourceAttr ("tencentcloud_clb_instance.target_group" , "target_group_name" , "tgt_grp_test" ),
44+ resource .TestCheckResourceAttr ("tencentcloud_clb_instance.target_group" , "port" , "33" ),
45+ resource .TestCheckResourceAttr ("tencentcloud_clb_instance.target_group" , "target_group_instances.bind_ip" , "10.0.0.4" ),
46+ resource .TestCheckResourceAttr ("tencentcloud_clb_instance.target_group" , "target_group_instances.port" , "33" ),
47+ ),
48+ },
49+ {
50+ Config : testAccClbInstanceTargetGroupUpdate ,
51+ Check : resource .ComposeTestCheckFunc (
52+ testAccCheckClbInstanceExists ("tencentcloud_clb_instance.target_group" ),
53+ resource .TestCheckResourceAttr ("tencentcloud_clb_instance.target_group" , "target_group_name" , "tgt_grp_test" ),
54+ resource .TestCheckResourceAttr ("tencentcloud_clb_instance.target_group" , "port" , "33" ),
55+ resource .TestCheckResourceAttr ("tencentcloud_clb_instance.target_group" , "target_group_instances.bind_ip" , "10.0.0.4" ),
56+ resource .TestCheckResourceAttr ("tencentcloud_clb_instance.target_group" , "target_group_instances.port" , "44" ),
57+ ),
58+ },
59+ },
60+ })
61+ }
62+
3163func testAccCheckClbTargetGroupDestroy (s * terraform.State ) error {
3264 logId := getLogId (contextNil )
3365 ctx := context .WithValue (context .TODO (), logIdKey , logId )
@@ -81,3 +113,25 @@ resource "tencentcloud_clb_target_group" "test"{
81113 target_group_name = "qwe"
82114}
83115`
116+
117+ const testAccClbInstanceTargetGroup = `
118+ resource "tencentcloud_clb_instance" "target_group" {
119+ target_group_name = "tgt_grp_test"
120+ port = 33
121+ target_group_instances {
122+ bind_ip = "10.0.0.4"
123+ port = 18800
124+ }
125+ }
126+ `
127+
128+ const testAccClbInstanceTargetGroupUpdate = `
129+ resource "tencentcloud_clb_instance" "target_group" {
130+ target_group_name = "tgt_grp_test"
131+ port = 44
132+ target_group_instances {
133+ bind_ip = "10.0.0.4"
134+ port = 18800
135+ }
136+ }
137+ `
0 commit comments