@@ -69,6 +69,7 @@ func resourceTencentCloudTcrVpcAttachment() *schema.Resource {
6969 Type : schema .TypeInt ,
7070 Optional : true ,
7171 ConflictsWith : []string {"region_name" },
72+ Deprecated : "this argument was deprecated, use `region_name` instead." ,
7273 Description : "ID of region. Conflict with region_name, can not be set at the same time." ,
7374 },
7475 "region_name" : {
@@ -154,14 +155,14 @@ func resourceTencentCloudTcrVpcAttachmentCreate(d *schema.ResourceData, meta int
154155 }
155156
156157 if enablePublicDomainDns := d .Get ("enable_public_domain_dns" ).(bool ); enablePublicDomainDns {
157- err := EnableTcrVpcDns (ctx , tcrService , instanceId , vpcId , subnetId , true )
158+ err := EnableTcrVpcDns (ctx , tcrService , instanceId , vpcId , subnetId , true , regionName )
158159 if err != nil {
159160 return err
160161 }
161162 }
162163
163164 if enableVpcDomainDns := d .Get ("enable_vpc_domain_dns" ).(bool ); enableVpcDomainDns {
164- err := EnableTcrVpcDns (ctx , tcrService , instanceId , vpcId , subnetId , false )
165+ err := EnableTcrVpcDns (ctx , tcrService , instanceId , vpcId , subnetId , false , regionName )
165166 if err != nil {
166167 return err
167168 }
@@ -240,17 +241,18 @@ func resourceTencentCloudTcrVpcAttachmentUpdate(d *schema.ResourceData, meta int
240241 instanceId = d .Get ("instance_id" ).(string )
241242 vpcId = d .Get ("vpc_id" ).(string )
242243 subnetId = d .Get ("subnet_id" ).(string )
244+ regionName = d .Get ("region_name" ).(string )
243245 )
244246
245247 d .Partial (true )
246248 if d .HasChange ("enable_public_domain_dns" ) {
247249 if isEnabled := d .Get ("enable_public_domain_dns" ).(bool ); isEnabled {
248- err := EnableTcrVpcDns (ctx , tcrService , instanceId , vpcId , subnetId , true )
250+ err := EnableTcrVpcDns (ctx , tcrService , instanceId , vpcId , subnetId , true , regionName )
249251 if err != nil {
250252 return err
251253 }
252254 } else {
253- err := DisableTcrVpcDns (ctx , tcrService , instanceId , vpcId , subnetId , true )
255+ err := DisableTcrVpcDns (ctx , tcrService , instanceId , vpcId , subnetId , true , regionName )
254256 if err != nil {
255257 return err
256258 }
@@ -260,12 +262,12 @@ func resourceTencentCloudTcrVpcAttachmentUpdate(d *schema.ResourceData, meta int
260262
261263 if d .HasChange ("enable_vpc_domain_dns" ) {
262264 if isEnabled := d .Get ("enable_vpc_domain_dns" ).(bool ); isEnabled {
263- err := EnableTcrVpcDns (ctx , tcrService , instanceId , vpcId , subnetId , false )
265+ err := EnableTcrVpcDns (ctx , tcrService , instanceId , vpcId , subnetId , false , regionName )
264266 if err != nil {
265267 return err
266268 }
267269 } else {
268- err := DisableTcrVpcDns (ctx , tcrService , instanceId , vpcId , subnetId , false )
270+ err := DisableTcrVpcDns (ctx , tcrService , instanceId , vpcId , subnetId , false , regionName )
269271 if err != nil {
270272 return err
271273 }
@@ -355,14 +357,14 @@ func WaitForAccessIpExists(ctx context.Context, tcrService TCRService, instanceI
355357 return
356358}
357359
358- func EnableTcrVpcDns (ctx context.Context , tcrService TCRService , instanceId string , vpcId string , subnetId string , usePublicDomain bool ) error {
360+ func EnableTcrVpcDns (ctx context.Context , tcrService TCRService , instanceId string , vpcId string , subnetId string , usePublicDomain bool , regionName string ) error {
359361 accessIp , err := WaitForAccessIpExists (ctx , tcrService , instanceId , vpcId , subnetId )
360362 if err != nil {
361363 return err
362364 }
363365
364366 outErr := resource .Retry (writeRetryTimeout , func () * resource.RetryError {
365- inErr := tcrService .CreateTcrVpcDns (ctx , instanceId , vpcId , accessIp , usePublicDomain )
367+ inErr := tcrService .CreateTcrVpcDns (ctx , instanceId , vpcId , accessIp , usePublicDomain , regionName )
366368 if inErr != nil {
367369 return retryError (inErr )
368370 }
@@ -372,14 +374,14 @@ func EnableTcrVpcDns(ctx context.Context, tcrService TCRService, instanceId stri
372374 return outErr
373375}
374376
375- func DisableTcrVpcDns (ctx context.Context , tcrService TCRService , instanceId string , vpcId string , subnetId string , usePublicDomain bool ) error {
377+ func DisableTcrVpcDns (ctx context.Context , tcrService TCRService , instanceId string , vpcId string , subnetId string , usePublicDomain bool , regionName string ) error {
376378 accessIp , err := WaitForAccessIpExists (ctx , tcrService , instanceId , vpcId , subnetId )
377379 if err != nil {
378380 return err
379381 }
380382
381383 outErr := resource .Retry (writeRetryTimeout , func () * resource.RetryError {
382- inErr := tcrService .DeleteTcrVpcDns (ctx , instanceId , vpcId , accessIp , usePublicDomain )
384+ inErr := tcrService .DeleteTcrVpcDns (ctx , instanceId , vpcId , accessIp , usePublicDomain , regionName )
383385 if inErr != nil {
384386 return retryError (inErr )
385387 }
0 commit comments