@@ -41,7 +41,6 @@ func ResourceTencentCloudCbsSnapshot() *schema.Resource {
4141 "tags" : {
4242 Type : schema .TypeMap ,
4343 Optional : true ,
44- Deprecated : "cbs snapshot do not support tag now." ,
4544 Description : "The available tags within this CBS Snapshot." ,
4645 },
4746 "storage_size" : {
@@ -81,20 +80,12 @@ func resourceTencentCloudCbsSnapshotCreate(d *schema.ResourceData, meta interfac
8180
8281 storageId := d .Get ("storage_id" ).(string )
8382 snapshotName := d .Get ("snapshot_name" ).(string )
84-
85- var tags map [string ]string
86-
87- if temp := helper .GetTags (d , "tags" ); len (temp ) > 0 {
88- tags = temp
89- }
90- cbsService := CbsService {
91- client : meta .(tccommon.ProviderMeta ).GetAPIV3Conn (),
92- }
83+ cbsService := CbsService {client : meta .(tccommon.ProviderMeta ).GetAPIV3Conn ()}
9384
9485 snapshotId := ""
9586 err := resource .Retry (tccommon .WriteRetryTimeout , func () * resource.RetryError {
9687 var e error
97- snapshotId , e = cbsService .CreateSnapshot (ctx , storageId , snapshotName , tags )
88+ snapshotId , e = cbsService .CreateSnapshot (ctx , storageId , snapshotName )
9889 if e != nil {
9990 return tccommon .RetryError (e )
10091 }
@@ -106,15 +97,6 @@ func resourceTencentCloudCbsSnapshotCreate(d *schema.ResourceData, meta interfac
10697 return err
10798 }
10899
109- if tags := helper .GetTags (d , "tags" ); len (tags ) > 0 {
110- tcClient := meta .(tccommon.ProviderMeta ).GetAPIV3Conn ()
111- tagService := svctag .NewTagService (tcClient )
112- resourceName := tccommon .BuildTagResourceName ("cvm" , "volume" , tcClient .Region , d .Id ())
113- if err := tagService .ModifyTags (ctx , resourceName , tags , nil ); err != nil {
114- return err
115- }
116- }
117-
118100 err = resource .Retry (20 * tccommon .ReadRetryTimeout , func () * resource.RetryError {
119101 snapshot , e := cbsService .DescribeSnapshotById (ctx , snapshotId )
120102 if e != nil {
@@ -136,6 +118,15 @@ func resourceTencentCloudCbsSnapshotCreate(d *schema.ResourceData, meta interfac
136118 return err
137119 }
138120
121+ if tags := helper .GetTags (d , "tags" ); len (tags ) > 0 {
122+ tcClient := meta .(tccommon.ProviderMeta ).GetAPIV3Conn ()
123+ tagService := svctag .NewTagService (tcClient )
124+ resourceName := tccommon .BuildTagResourceName ("cvm" , "volume" , tcClient .Region , d .Id ())
125+ if err := tagService .ModifyTags (ctx , resourceName , tags , nil ); err != nil {
126+ return err
127+ }
128+ }
129+
139130 return resourceTencentCloudCbsSnapshotRead (d , meta )
140131}
141132
0 commit comments