@@ -199,6 +199,7 @@ func resourceTencentCloudClbServerAttachmentCreate(d *schema.ResourceData, meta
199
199
} else if domain != "" && url != "" {
200
200
id = fmt .Sprintf ("%s,%s#%v#%v" , domain , url , d .Get ("listener_id" ), d .Get ("clb_id" ))
201
201
} else {
202
+ // only api support for now
202
203
id = fmt .Sprintf ("%s#%v#%v" , "" , d .Get ("listener_id" ), d .Get ("clb_id" ))
203
204
}
204
205
@@ -265,18 +266,22 @@ func resourceTencentCloudClbServerAttachmentRead(d *schema.ResourceData, meta in
265
266
_ = d .Set ("listener_id" , listenerId )
266
267
_ = d .Set ("protocol_type" , instance .Protocol )
267
268
269
+ if locationId != "" {
270
+ _ = d .Set ("rule_id" , locationId )
271
+ }
272
+
268
273
if domain != "" && url != "" {
269
274
_ = d .Set ("domain" , domain )
270
275
_ = d .Set ("url" , url )
271
276
}
272
277
273
278
var onlineTargets []* clb.Backend
274
279
if * instance .Protocol == CLB_LISTENER_PROTOCOL_HTTP || * instance .Protocol == CLB_LISTENER_PROTOCOL_HTTPS {
275
- _ = d .Set ("rule_id" , locationId )
276
280
if len (instance .Rules ) > 0 {
277
281
for _ , loc := range instance .Rules {
278
- if locationId == "" || locationId == * loc .LocationId {
282
+ if ( locationId == * loc . LocationId ) || ( domain == * loc .Domain && url == * loc . Url ) {
279
283
onlineTargets = loc .Targets
284
+ break
280
285
}
281
286
}
282
287
}
@@ -296,7 +301,10 @@ func resourceTencentCloudClbServerAttachmentRead(d *schema.ResourceData, meta in
296
301
297
302
targets = append (targets , target )
298
303
} else if * onlineTarget .Type == CLB_BACKEND_TYPE_ENI || * onlineTarget .Type == CLB_BACKEND_TYPE_NAT ||
299
- * onlineTarget .Type == CLB_BACKEND_TYPE_CCN || * onlineTarget .Type == CLB_BACKEND_TYPE_SRV {
304
+ * onlineTarget .Type == CLB_BACKEND_TYPE_CCN || * onlineTarget .Type == CLB_BACKEND_TYPE_SRV ||
305
+ * onlineTarget .Type == CLB_BACKEND_TYPE_MS || * onlineTarget .Type == CLB_BACKEND_TYPE_EVM ||
306
+ * onlineTarget .Type == CLB_BACKEND_TYPE_GR || * onlineTarget .Type == CLB_BACKEND_TYPE_IPDC ||
307
+ * onlineTarget .Type == CLB_BACKEND_TYPE_PVGW {
300
308
target := map [string ]interface {}{
301
309
"weight" : int (* onlineTarget .Weight ),
302
310
"port" : int (* onlineTarget .Port ),
0 commit comments