@@ -116,6 +116,38 @@ func TestAccTencentCloudClbInstance_internal(t *testing.T) {
116116 })
117117}
118118
119+ func TestAccTencentCloudClbInstanceTargetGroup (t * testing.T ) {
120+ t .Parallel ()
121+
122+ resource .Test (t , resource.TestCase {
123+ PreCheck : func () { testAccPreCheck (t ) },
124+ Providers : testAccProviders ,
125+ CheckDestroy : testAccCheckClbInstanceDestroy ,
126+ Steps : []resource.TestStep {
127+ {
128+ Config : testAccClbInstanceTargetGroup ,
129+ Check : resource .ComposeTestCheckFunc (
130+ testAccCheckClbInstanceExists ("tencentcloud_clb_instance.target_group" ),
131+ resource .TestCheckResourceAttr ("tencentcloud_clb_instance.target_group" , "target_group_name" , "tgt_grp_test" ),
132+ resource .TestCheckResourceAttr ("tencentcloud_clb_instance.target_group" , "port" , "33" ),
133+ resource .TestCheckResourceAttr ("tencentcloud_clb_instance.target_group" , "target_group_instances.bind_ip" , "10.0.0.4" ),
134+ resource .TestCheckResourceAttr ("tencentcloud_clb_instance.target_group" , "target_group_instances.port" , "33" ),
135+ ),
136+ },
137+ {
138+ Config : testAccClbInstanceTargetGroupUpdate ,
139+ Check : resource .ComposeTestCheckFunc (
140+ testAccCheckClbInstanceExists ("tencentcloud_clb_instance.target_group" ),
141+ resource .TestCheckResourceAttr ("tencentcloud_clb_instance.target_group" , "target_group_name" , "tgt_grp_test" ),
142+ resource .TestCheckResourceAttr ("tencentcloud_clb_instance.target_group" , "port" , "33" ),
143+ resource .TestCheckResourceAttr ("tencentcloud_clb_instance.target_group" , "target_group_instances.bind_ip" , "10.0.0.4" ),
144+ resource .TestCheckResourceAttr ("tencentcloud_clb_instance.target_group" , "target_group_instances.port" , "44" ),
145+ ),
146+ },
147+ },
148+ })
149+ }
150+
119151func testAccCheckClbInstanceDestroy (s * terraform.State ) error {
120152 logId := getLogId (contextNil )
121153 ctx := context .WithValue (context .TODO (), logIdKey , logId )
@@ -280,3 +312,25 @@ resource "tencentcloud_clb_instance" "clb_open" {
280312 }
281313}
282314`
315+
316+ const testAccClbInstanceTargetGroup = `
317+ resource "tencentcloud_clb_instance" "target_group" {
318+ target_group_name = "tgt_grp_test"
319+ port = 33
320+ target_group_instances {
321+ bind_ip = "10.0.0.4"
322+ port = 18800
323+ }
324+ }
325+ `
326+
327+ const testAccClbInstanceTargetGroupUpdate = `
328+ resource "tencentcloud_clb_instance" "target_group" {
329+ target_group_name = "tgt_grp_test"
330+ port = 44
331+ target_group_instances {
332+ bind_ip = "10.0.0.4"
333+ port = 18800
334+ }
335+ }
336+ `
0 commit comments