@@ -63,7 +63,14 @@ func resourceTencentCloudTcrVpcAttachment() *schema.Resource {
63
63
"region_id" : {
64
64
Type : schema .TypeInt ,
65
65
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." ,
67
74
},
68
75
"enable_public_domain_dns" : {
69
76
Type : schema .TypeBool ,
@@ -105,12 +112,13 @@ func resourceTencentCloudTcrVpcAttachmentCreate(d *schema.ResourceData, meta int
105
112
vpcId = d .Get ("vpc_id" ).(string )
106
113
subnetId = d .Get ("subnet_id" ).(string )
107
114
regionId = int64 (d .Get ("region_id" ).(int ))
115
+ regionName = d .Get ("region_name" ).(string )
108
116
outErr , inErr error
109
117
has bool
110
118
)
111
119
112
120
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 )
114
122
if inErr != nil {
115
123
return retryError (inErr )
116
124
}
@@ -272,6 +280,7 @@ func resourceTencentCLoudTcrVpcAttachmentDelete(d *schema.ResourceData, meta int
272
280
273
281
resourceId := d .Id ()
274
282
regionId := d .Get ("region_id" ).(int )
283
+ regionName := d .Get ("region_name" ).(string )
275
284
items := strings .Split (resourceId , FILED_SP )
276
285
if len (items ) != 3 {
277
286
return fmt .Errorf ("invalid ID %s" , resourceId )
@@ -286,10 +295,10 @@ func resourceTencentCLoudTcrVpcAttachmentDelete(d *schema.ResourceData, meta int
286
295
var inErr , outErr error
287
296
var has bool
288
297
289
- outErr = tcrService .DeleteTCRVPCAttachment (ctx , instanceId , vpcId , subnetId , regionId )
298
+ outErr = tcrService .DeleteTCRVPCAttachment (ctx , instanceId , vpcId , subnetId , regionId , regionName )
290
299
if outErr != nil {
291
300
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 )
293
302
if inErr != nil {
294
303
return retryError (inErr )
295
304
}
0 commit comments