@@ -286,6 +286,13 @@ func resourceTencentCloudTseCngwService() *schema.Resource {
286286 Type : schema .TypeString ,
287287 Description : "service id." ,
288288 },
289+
290+ "tags" : {
291+ Type : schema .TypeMap ,
292+ Optional : true ,
293+ Description : "Tag description list." ,
294+ Deprecated : "Deprecate ineffective tags" ,
295+ },
289296 },
290297 }
291298}
@@ -425,6 +432,16 @@ func resourceTencentCloudTseCngwServiceCreate(d *schema.ResourceData, meta inter
425432
426433 d .SetId (gatewayId + FILED_SP + name )
427434
435+ ctx := context .WithValue (context .TODO (), logIdKey , logId )
436+ if tags := helper .GetTags (d , "tags" ); len (tags ) > 0 {
437+ tagService := TagService {client : meta .(* TencentCloudClient ).apiV3Conn }
438+ region := meta .(* TencentCloudClient ).apiV3Conn .Region
439+ resourceName := fmt .Sprintf ("qcs::tse:%s:uin/:cngw_service/%s" , region , d .Id ())
440+ if err := tagService .ModifyTags (ctx , resourceName , tags , nil ); err != nil {
441+ return err
442+ }
443+ }
444+
428445 return resourceTencentCloudTseCngwServiceRead (d , meta )
429446}
430447
@@ -597,6 +614,14 @@ func resourceTencentCloudTseCngwServiceRead(d *schema.ResourceData, meta interfa
597614 _ = d .Set ("service_id" , cngwService .ID )
598615 }
599616
617+ tcClient := meta .(* TencentCloudClient ).apiV3Conn
618+ tagService := & TagService {client : tcClient }
619+ tags , err := tagService .DescribeResourceTags (ctx , "tse" , "cngw_service" , tcClient .Region , d .Id ())
620+ if err != nil {
621+ return err
622+ }
623+ _ = d .Set ("tags" , tags )
624+
600625 return nil
601626}
602627
@@ -754,6 +779,17 @@ func resourceTencentCloudTseCngwServiceUpdate(d *schema.ResourceData, meta inter
754779 return err
755780 }
756781
782+ if d .HasChange ("tags" ) {
783+ tcClient := meta .(* TencentCloudClient ).apiV3Conn
784+ tagService := & TagService {client : tcClient }
785+ oldTags , newTags := d .GetChange ("tags" )
786+ replaceTags , deleteTags := diffTags (oldTags .(map [string ]interface {}), newTags .(map [string ]interface {}))
787+ resourceName := BuildTagResourceName ("tse" , "cngw_service" , tcClient .Region , d .Id ())
788+ if err := tagService .ModifyTags (ctx , resourceName , replaceTags , deleteTags ); err != nil {
789+ return err
790+ }
791+ }
792+
757793 return resourceTencentCloudTseCngwServiceRead (d , meta )
758794}
759795
0 commit comments