@@ -22,14 +22,11 @@ func dataSourceTencentCloudSsmProducts() *schema.Resource {
2222 Read : dataSourceTencentCloudSsmProductsRead ,
2323 Schema : map [string ]* schema.Schema {
2424 "products" : {
25- Computed : true ,
26- Type : schema .TypeSet ,
27- Elem : & schema.Schema {
28- Type : schema .TypeString ,
29- },
25+ Computed : true ,
26+ Type : schema .TypeSet ,
27+ Elem : & schema.Schema {Type : schema .TypeString },
3028 Description : "List of supported services." ,
3129 },
32-
3330 "result_output_file" : {
3431 Type : schema .TypeString ,
3532 Optional : true ,
@@ -43,37 +40,38 @@ func dataSourceTencentCloudSsmProductsRead(d *schema.ResourceData, meta interfac
4340 defer logElapsed ("data_source.tencentcloud_ssm_products.read" )()
4441 defer inconsistentCheck (d , meta )()
4542
46- logId := getLogId (contextNil )
47-
48- ctx := context .WithValue (context .TODO (), logIdKey , logId )
49-
50- service := SsmService {client : meta .(* TencentCloudClient ).apiV3Conn }
51-
52- var products []* string
43+ var (
44+ logId = getLogId (contextNil )
45+ ctx = context .WithValue (context .TODO (), logIdKey , logId )
46+ service = SsmService {client : meta .(* TencentCloudClient ).apiV3Conn }
47+ products []* string
48+ )
5349
5450 err := resource .Retry (readRetryTimeout , func () * resource.RetryError {
5551 result , e := service .DescribeSsmProductsByFilter (ctx )
5652 if e != nil {
5753 return retryError (e )
5854 }
55+
5956 products = result
6057 return nil
6158 })
59+
6260 if err != nil {
6361 return err
6462 }
6563
6664 if products != nil {
6765 _ = d .Set ("products" , products )
6866 }
69- ids := helper .StrListToStr (products )
7067
71- d .SetId (ids )
68+ d .SetId (helper . StrListToStr ( products ) )
7269 output , ok := d .GetOk ("result_output_file" )
7370 if ok && output .(string ) != "" {
7471 if e := writeToFile (output .(string ), products ); e != nil {
7572 return e
7673 }
7774 }
75+
7876 return nil
7977}
0 commit comments