@@ -58,6 +58,16 @@ func dataSourceTencentCloudInstances() *schema.Resource {
58
58
Optional : true ,
59
59
Description : "ID of a vpc subnetwork." ,
60
60
},
61
+ "instance_set_ids" : {
62
+ Type : schema .TypeList ,
63
+ Optional : true ,
64
+ MaxItems : 100 ,
65
+ ConflictsWith : []string {"instance_id" , "instance_name" , "availability_zone" , "project_id" , "vpc_id" , "subnet_id" , "tags" },
66
+ Elem : & schema.Schema {
67
+ Type : schema .TypeString ,
68
+ },
69
+ Description : "Instance set ids, max length is 100, conflict with other field." ,
70
+ },
61
71
"tags" : {
62
72
Type : schema .TypeMap ,
63
73
Optional : true ,
@@ -251,6 +261,8 @@ func dataSourceTencentCloudInstancesRead(d *schema.ResourceData, meta interface{
251
261
client : meta .(* TencentCloudClient ).apiV3Conn ,
252
262
}
253
263
264
+ var instanceSetIds []* string
265
+
254
266
filter := make (map [string ]string )
255
267
if v , ok := d .GetOk ("instance_id" ); ok {
256
268
filter ["instance-id" ] = v .(string )
@@ -270,6 +282,10 @@ func dataSourceTencentCloudInstancesRead(d *schema.ResourceData, meta interface{
270
282
if v , ok := d .GetOk ("subnet_id" ); ok {
271
283
filter ["subnet-id" ] = v .(string )
272
284
}
285
+ if v , ok := d .GetOk ("instance_set_ids" ); ok {
286
+ instanceSetIds = helper .InterfacesStringsPoint (v .([]interface {}))
287
+ }
288
+
273
289
if v , ok := d .GetOk ("tags" ); ok {
274
290
for key , value := range v .(map [string ]interface {}) {
275
291
filter ["tag:" + key ] = value .(string )
@@ -279,7 +295,7 @@ func dataSourceTencentCloudInstancesRead(d *schema.ResourceData, meta interface{
279
295
var instances []* cvm.Instance
280
296
var errRet error
281
297
err := resource .Retry (readRetryTimeout , func () * resource.RetryError {
282
- instances , errRet = cvmService .DescribeInstanceByFilter (ctx , filter )
298
+ instances , errRet = cvmService .DescribeInstanceByFilter (ctx , instanceSetIds , filter )
283
299
if errRet != nil {
284
300
return retryError (errRet , InternalError )
285
301
}
0 commit comments