@@ -46,12 +46,33 @@ func TestAccTencentCloudClbTargetGroupAttachmentsResource_target(t *testing.T) {
4646 })
4747}
4848
49+ func TestAccTencentCloudClbTargetGroupAttachmentsResource_sync (t * testing.T ) {
50+ t .Parallel ()
51+ resource .Test (t , resource.TestCase {
52+ PreCheck : func () {
53+ tcacctest .AccPreCheck (t )
54+ },
55+ Providers : tcacctest .AccProviders ,
56+ Steps : []resource.TestStep {
57+ {
58+ Config : testAccClbTargetGroupAttachmentsParallel ,
59+ Check : resource .ComposeTestCheckFunc (resource .TestCheckResourceAttrSet ("tencentcloud_clb_target_group_attachments.target_group_attachments" , "id" ),
60+ resource .TestCheckResourceAttrSet ("tencentcloud_clb_target_group_attachments.target_group_attachments" , "target_group_id" ),
61+ resource .TestCheckResourceAttrSet ("tencentcloud_clb_target_group_attachments.target_group_attachments" , "associations.#" ),
62+ resource .TestCheckResourceAttrSet ("tencentcloud_clb_target_group_attachments.target_group_attachments1" , "target_group_id" ),
63+ resource .TestCheckResourceAttrSet ("tencentcloud_clb_target_group_attachments.target_group_attachments1" , "associations.#" ),
64+ ),
65+ },
66+ },
67+ })
68+ }
69+
4970const testAccClbTargetGroupAttachments = `
5071
5172resource "tencentcloud_clb_instance" "clb_basic" {
5273 network_type = "OPEN"
5374 clb_name = "tf_test_clb_attach_example"
54- vpc_id = "vpc-5kwngvex "
75+ vpc_id = "vpc-efc9vddt "
5576}
5677
5778resource "tencentcloud_clb_listener" "public_listeners" {
@@ -103,22 +124,22 @@ resource "tencentcloud_clb_target_group_attachments" "target_group_attachments"
103124 load_balancer_id = tencentcloud_clb_instance.clb_basic.id
104125 associations {
105126 listener_id = tencentcloud_clb_listener.public_listeners.listener_id
106- target_group_id = "lbtg-88ace9ra "
127+ target_group_id = "lbtg-f0od5ack "
107128 location_id = tencentcloud_clb_listener_rule.rule_basic.rule_id
108129 }
109130 associations {
110131 listener_id = tencentcloud_clb_listener.public_listeners.listener_id
111- target_group_id = "lbtg-ldkb0xxg "
132+ target_group_id = "lbtg-h7lzmdts "
112133 location_id = tencentcloud_clb_listener_rule.rule_basic2.rule_id
113134 }
114135 associations {
115136 listener_id = tencentcloud_clb_listener.public_listeners.listener_id
116- target_group_id = "lbtg-7sgej5ey "
137+ target_group_id = "lbtg-577temh4 "
117138 location_id = tencentcloud_clb_listener_rule.rule_basic3.rule_id
118139 }
119140 associations {
120141 listener_id = tencentcloud_clb_listener.public_listeners.listener_id
121- target_group_id = "lbtg-og25rlfk "
142+ target_group_id = "lbtg-119vqig8 "
122143 location_id = tencentcloud_clb_listener_rule.rule_basic4.rule_id
123144 }
124145 depends_on = [tencentcloud_clb_listener.public_listeners,
@@ -134,27 +155,27 @@ const testAccClbTargetGroupAttachmentsTarget = `
134155resource "tencentcloud_clb_instance" "clb_basic" {
135156 network_type = "OPEN"
136157 clb_name = "tf_test_clb_attach_1"
137- vpc_id = "vpc-5kwngvex "
158+ vpc_id = "vpc-efc9vddt "
138159}
139160resource "tencentcloud_clb_instance" "clb_basic2" {
140161 network_type = "OPEN"
141162 clb_name = "tf_test_clb_attach_2"
142- vpc_id = "vpc-5kwngvex "
163+ vpc_id = "vpc-efc9vddt "
143164}
144165resource "tencentcloud_clb_instance" "clb_basic3" {
145166 network_type = "OPEN"
146167 clb_name = "tf_test_clb_attach_3"
147- vpc_id = "vpc-5kwngvex "
168+ vpc_id = "vpc-efc9vddt "
148169}
149170resource "tencentcloud_clb_instance" "clb_basic4" {
150171 network_type = "OPEN"
151172 clb_name = "tf_test_clb_attach_4"
152- vpc_id = "vpc-5kwngvex "
173+ vpc_id = "vpc-efc9vddt "
153174}
154175resource "tencentcloud_clb_instance" "clb_basic5" {
155176 network_type = "OPEN"
156177 clb_name = "tf_test_clb_attach_5"
157- vpc_id = "vpc-5kwngvex "
178+ vpc_id = "vpc-efc9vddt "
158179}
159180
160181
@@ -234,7 +255,7 @@ resource "tencentcloud_clb_listener_rule" "rule_basic5" {
234255 target_type = "TARGETGROUP"
235256}
236257resource "tencentcloud_clb_target_group_attachments" "target_group_attachments" {
237- target_group_id = "lbtg-dajxvv8q "
258+ target_group_id = "lbtg-nxd0dmcm "
238259 associations {
239260 listener_id = tencentcloud_clb_listener.public_listeners.listener_id
240261 load_balancer_id = tencentcloud_clb_instance.clb_basic.id
@@ -274,3 +295,61 @@ resource "tencentcloud_clb_target_group_attachments" "target_group_attachments"
274295 tencentcloud_clb_listener_rule.rule_basic]
275296}
276297`
298+ const testAccClbTargetGroupAttachmentsParallel = `
299+ resource "tencentcloud_clb_instance" "clb_basic" {
300+ network_type = "OPEN"
301+ clb_name = "tf_test_clb_attach_1"
302+ vpc_id = "vpc-efc9vddt"
303+ }
304+ resource "tencentcloud_clb_listener" "public_listeners" {
305+ clb_id = tencentcloud_clb_instance.clb_basic.id
306+ protocol = "HTTP"
307+ port = "8090"
308+ listener_name = "iac-test-attach"
309+ }
310+ resource "tencentcloud_clb_listener" "public_listeners2" {
311+ clb_id = tencentcloud_clb_instance.clb_basic.id
312+ protocol = "HTTP"
313+ port = "8099"
314+ listener_name = "iac-test-attach-2"
315+ }
316+ resource "tencentcloud_clb_listener_rule" "rule_basic" {
317+ clb_id = tencentcloud_clb_instance.clb_basic.id
318+ listener_id = tencentcloud_clb_listener.public_listeners.listener_id
319+ domain = "abc.com"
320+ url = "/"
321+ session_expire_time = 30
322+ scheduler = "WRR"
323+ target_type = "TARGETGROUP"
324+ }
325+ resource "tencentcloud_clb_listener_rule" "rule_basic2" {
326+ clb_id = tencentcloud_clb_instance.clb_basic.id
327+ listener_id = tencentcloud_clb_listener.public_listeners2.listener_id
328+ domain = "baidu.com"
329+ url = "/"
330+ session_expire_time = 30
331+ scheduler = "WRR"
332+ target_type = "TARGETGROUP"
333+ }
334+ resource "tencentcloud_clb_target_group_attachments" "target_group_attachments" {
335+ target_group_id = "lbtg-fa1l7oh2"
336+ associations {
337+ load_balancer_id = tencentcloud_clb_instance.clb_basic.id
338+ listener_id = tencentcloud_clb_listener.public_listeners.listener_id
339+ location_id=tencentcloud_clb_listener_rule.rule_basic.rule_id
340+ }
341+ depends_on = [tencentcloud_clb_listener_rule.rule_basic,
342+ tencentcloud_clb_listener_rule.rule_basic,
343+ tencentcloud_clb_listener.public_listeners,
344+ tencentcloud_clb_listener.public_listeners2]
345+ }
346+ resource "tencentcloud_clb_target_group_attachments" "target_group_attachments1" {
347+ target_group_id = "lbtg-aw5hicve"
348+ associations {
349+ load_balancer_id = tencentcloud_clb_instance.clb_basic.id
350+ listener_id = tencentcloud_clb_listener.public_listeners2.listener_id
351+ location_id=tencentcloud_clb_listener_rule.rule_basic2.rule_id
352+
353+ }
354+ }
355+ `
0 commit comments