@@ -199,6 +199,7 @@ func resourceTencentCloudClbServerAttachmentCreate(d *schema.ResourceData, meta
199199 } else if domain != "" && url != "" {
200200 id = fmt .Sprintf ("%s,%s#%v#%v" , domain , url , d .Get ("listener_id" ), d .Get ("clb_id" ))
201201 } else {
202+ // only api support for now
202203 id = fmt .Sprintf ("%s#%v#%v" , "" , d .Get ("listener_id" ), d .Get ("clb_id" ))
203204 }
204205
@@ -265,18 +266,22 @@ func resourceTencentCloudClbServerAttachmentRead(d *schema.ResourceData, meta in
265266 _ = d .Set ("listener_id" , listenerId )
266267 _ = d .Set ("protocol_type" , instance .Protocol )
267268
269+ if locationId != "" {
270+ _ = d .Set ("rule_id" , locationId )
271+ }
272+
268273 if domain != "" && url != "" {
269274 _ = d .Set ("domain" , domain )
270275 _ = d .Set ("url" , url )
271276 }
272277
273278 var onlineTargets []* clb.Backend
274279 if * instance .Protocol == CLB_LISTENER_PROTOCOL_HTTP || * instance .Protocol == CLB_LISTENER_PROTOCOL_HTTPS {
275- _ = d .Set ("rule_id" , locationId )
276280 if len (instance .Rules ) > 0 {
277281 for _ , loc := range instance .Rules {
278- if locationId == "" || locationId == * loc .LocationId {
282+ if ( locationId == * loc . LocationId ) || ( domain == * loc .Domain && url == * loc . Url ) {
279283 onlineTargets = loc .Targets
284+ break
280285 }
281286 }
282287 }
@@ -296,7 +301,10 @@ func resourceTencentCloudClbServerAttachmentRead(d *schema.ResourceData, meta in
296301
297302 targets = append (targets , target )
298303 } 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 {
300308 target := map [string ]interface {}{
301309 "weight" : int (* onlineTarget .Weight ),
302310 "port" : int (* onlineTarget .Port ),
0 commit comments