@@ -63,7 +63,14 @@ func resourceTencentCloudTcrVpcAttachment() *schema.Resource {
6363 "region_id" : {
6464 Type : schema .TypeInt ,
6565 Optional : true ,
66- Description : "ID of region." ,
66+ ConflictsWith : []string {"region_name" },
67+ Description : "ID of region. Conflict with region_name, can not be set at the same time." ,
68+ },
69+ "region_name" : {
70+ Type : schema .TypeString ,
71+ Optional : true ,
72+ ConflictsWith : []string {"region_id" },
73+ Description : "Name of region. Conflict with region_id, can not be set at the same time." ,
6774 },
6875 "enable_public_domain_dns" : {
6976 Type : schema .TypeBool ,
@@ -105,12 +112,13 @@ func resourceTencentCloudTcrVpcAttachmentCreate(d *schema.ResourceData, meta int
105112 vpcId = d .Get ("vpc_id" ).(string )
106113 subnetId = d .Get ("subnet_id" ).(string )
107114 regionId = int64 (d .Get ("region_id" ).(int ))
115+ regionName = d .Get ("region_name" ).(string )
108116 outErr , inErr error
109117 has bool
110118 )
111119
112120 outErr = resource .Retry (writeRetryTimeout , func () * resource.RetryError {
113- inErr = tcrService .CreateTCRVPCAttachment (ctx , instanceId , vpcId , subnetId , regionId )
121+ inErr = tcrService .CreateTCRVPCAttachment (ctx , instanceId , vpcId , subnetId , regionId , regionName )
114122 if inErr != nil {
115123 return retryError (inErr )
116124 }
@@ -272,6 +280,7 @@ func resourceTencentCLoudTcrVpcAttachmentDelete(d *schema.ResourceData, meta int
272280
273281 resourceId := d .Id ()
274282 regionId := d .Get ("region_id" ).(int )
283+ regionName := d .Get ("region_name" ).(string )
275284 items := strings .Split (resourceId , FILED_SP )
276285 if len (items ) != 3 {
277286 return fmt .Errorf ("invalid ID %s" , resourceId )
@@ -286,10 +295,10 @@ func resourceTencentCLoudTcrVpcAttachmentDelete(d *schema.ResourceData, meta int
286295 var inErr , outErr error
287296 var has bool
288297
289- outErr = tcrService .DeleteTCRVPCAttachment (ctx , instanceId , vpcId , subnetId , regionId )
298+ outErr = tcrService .DeleteTCRVPCAttachment (ctx , instanceId , vpcId , subnetId , regionId , regionName )
290299 if outErr != nil {
291300 outErr = resource .Retry (writeRetryTimeout , func () * resource.RetryError {
292- inErr = tcrService .DeleteTCRVPCAttachment (ctx , instanceId , vpcId , subnetId , regionId )
301+ inErr = tcrService .DeleteTCRVPCAttachment (ctx , instanceId , vpcId , subnetId , regionId , regionName )
293302 if inErr != nil {
294303 return retryError (inErr )
295304 }
0 commit comments