@@ -58,6 +58,16 @@ func dataSourceTencentCloudInstances() *schema.Resource {
5858 Optional : true ,
5959 Description : "ID of a vpc subnetwork." ,
6060 },
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+ },
6171 "tags" : {
6272 Type : schema .TypeMap ,
6373 Optional : true ,
@@ -251,6 +261,8 @@ func dataSourceTencentCloudInstancesRead(d *schema.ResourceData, meta interface{
251261 client : meta .(* TencentCloudClient ).apiV3Conn ,
252262 }
253263
264+ var instanceSetIds []* string
265+
254266 filter := make (map [string ]string )
255267 if v , ok := d .GetOk ("instance_id" ); ok {
256268 filter ["instance-id" ] = v .(string )
@@ -270,6 +282,10 @@ func dataSourceTencentCloudInstancesRead(d *schema.ResourceData, meta interface{
270282 if v , ok := d .GetOk ("subnet_id" ); ok {
271283 filter ["subnet-id" ] = v .(string )
272284 }
285+ if v , ok := d .GetOk ("instance_set_ids" ); ok {
286+ instanceSetIds = helper .InterfacesStringsPoint (v .([]interface {}))
287+ }
288+
273289 if v , ok := d .GetOk ("tags" ); ok {
274290 for key , value := range v .(map [string ]interface {}) {
275291 filter ["tag:" + key ] = value .(string )
@@ -279,7 +295,7 @@ func dataSourceTencentCloudInstancesRead(d *schema.ResourceData, meta interface{
279295 var instances []* cvm.Instance
280296 var errRet error
281297 err := resource .Retry (readRetryTimeout , func () * resource.RetryError {
282- instances , errRet = cvmService .DescribeInstanceByFilter (ctx , filter )
298+ instances , errRet = cvmService .DescribeInstanceByFilter (ctx , instanceSetIds , filter )
283299 if errRet != nil {
284300 return retryError (errRet , InternalError )
285301 }
0 commit comments