Skip to content

Commit 71bc6d8

Browse files
author
hellertang
authored
tcr vpc attachment support region (#678)
1 parent 7112aa5 commit 71bc6d8

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

tencentcloud/resource_tc_tcr_vpc_attachment.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ func resourceTencentCloudTcrVpcAttachment() *schema.Resource {
6060
ForceNew: true,
6161
Description: "ID of subnet.",
6262
},
63+
"region_id": {
64+
Type: schema.TypeInt,
65+
Optional: true,
66+
Description: "Whether to enable public domain dns. Default value is `false`.",
67+
},
6368
"enable_public_domain_dns": {
6469
Type: schema.TypeBool,
6570
Optional: true,
@@ -99,12 +104,13 @@ func resourceTencentCloudTcrVpcAttachmentCreate(d *schema.ResourceData, meta int
99104
instanceId = d.Get("instance_id").(string)
100105
vpcId = d.Get("vpc_id").(string)
101106
subnetId = d.Get("subnet_id").(string)
107+
regionId = int64(d.Get("region_id").(int))
102108
outErr, inErr error
103109
has bool
104110
)
105111

106112
outErr = resource.Retry(writeRetryTimeout, func() *resource.RetryError {
107-
inErr = tcrService.CreateTCRVPCAttachment(ctx, instanceId, vpcId, subnetId)
113+
inErr = tcrService.CreateTCRVPCAttachment(ctx, instanceId, vpcId, subnetId, regionId)
108114
if inErr != nil {
109115
return retryError(inErr)
110116
}

tencentcloud/service_tencentcloud_tcr.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ func (me *TCRService) DescribeTCRLongTermTokenById(ctx context.Context, instance
580580
}
581581

582582
//VPC attachment
583-
func (me *TCRService) CreateTCRVPCAttachment(ctx context.Context, instanceId string, vpcId string, subnetId string) (errRet error) {
583+
func (me *TCRService) CreateTCRVPCAttachment(ctx context.Context, instanceId string, vpcId string, subnetId string, regionId int64) (errRet error) {
584584
logId := getLogId(ctx)
585585
request := tcr.NewManageInternalEndpointRequest()
586586
defer func() {
@@ -592,6 +592,7 @@ func (me *TCRService) CreateTCRVPCAttachment(ctx context.Context, instanceId str
592592
request.VpcId = &vpcId
593593
request.SubnetId = &subnetId
594594
request.Operation = helper.String("Create")
595+
request.RegionId = helper.Int64Uint64(regionId)
595596

596597
ratelimit.Check(request.GetAction())
597598
response, err := me.client.UseTCRClient().ManageInternalEndpoint(request)

0 commit comments

Comments
 (0)