Skip to content

Commit

Permalink
fix(vpc): [121514068] tencentcloud_vpc_end_point update `end_point_…
Browse files Browse the repository at this point in the history
…vip` params (#3053)

* add

* add

* add
  • Loading branch information
SevenEarth authored Jan 3, 2025
1 parent 2bba629 commit 488964d
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 23 deletions.
3 changes: 3 additions & 0 deletions .changelog/3053.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/tencentcloud_vpc_end_point: update `end_point_vip` params
```
38 changes: 26 additions & 12 deletions tencentcloud/services/pls/resource_tc_vpc_end_point.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ func ResourceTencentCloudVpcEndPoint() *schema.Resource {

"end_point_vip": {
Optional: true,
Computed: true,
Type: schema.TypeString,
Description: "VIP of endpoint ip.",
},
Expand Down Expand Up @@ -128,13 +129,24 @@ func resourceTencentCloudVpcEndPointCreate(d *schema.ResourceData, meta interfac
} else {
log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), result.ToJsonString())
}

if result == nil || result.Response == nil || result.Response.EndPoint == nil {
return resource.NonRetryableError(fmt.Errorf("Create vpc endPoint failed, Response is nil."))
}

response = result
return nil
})

if err != nil {
log.Printf("[CRITAL]%s create vpc endPoint failed, reason:%+v", logId, err)
return err
}

if response.Response.EndPoint.EndPointId == nil {
return fmt.Errorf("EndPointId is nil.")
}

endPointId = *response.Response.EndPoint.EndPointId
d.SetId(endPointId)

Expand Down Expand Up @@ -258,20 +270,22 @@ func resourceTencentCloudVpcEndPointUpdate(d *schema.ResourceData, meta interfac
if v, ok := d.GetOk("security_groups_ids"); ok {
request.SecurityGroupIds = helper.InterfacesStringsPoint(v.([]interface{}))
}
}

err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError {
result, e := meta.(tccommon.ProviderMeta).GetAPIV3Conn().UseVpcClient().ModifyVpcEndPointAttribute(request)
if e != nil {
return tccommon.RetryError(e)
} else {
log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), result.ToJsonString())
err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError {
result, e := meta.(tccommon.ProviderMeta).GetAPIV3Conn().UseVpcClient().ModifyVpcEndPointAttribute(request)
if e != nil {
return tccommon.RetryError(e)
} else {
log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), result.ToJsonString())
}

return nil
})

if err != nil {
log.Printf("[CRITAL]%s create vpc endPoint failed, reason:%+v", logId, err)
return err
}
return nil
})
if err != nil {
log.Printf("[CRITAL]%s create vpc endPoint failed, reason:%+v", logId, err)
return err
}

return resourceTencentCloudVpcEndPointRead(d, meta)
Expand Down
10 changes: 5 additions & 5 deletions tencentcloud/services/pls/resource_tc_vpc_end_point.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Provides a resource to create a vpc end_point
Provides a resource to create a VPC end point

Example Usage

```hcl
resource "tencentcloud_vpc_end_point" "end_point" {
resource "tencentcloud_vpc_end_point" "example" {
vpc_id = "vpc-391sv4w3"
subnet_id = "subnet-ljyn7h30"
end_point_name = "terraform-test"
end_point_name = "tf-example"
end_point_service_id = "vpcsvc-69y13tdb"
end_point_vip = "10.0.2.1"
Expand All @@ -20,8 +20,8 @@ resource "tencentcloud_vpc_end_point" "end_point" {

Import

vpc end_point can be imported using the id, e.g.
VPC end point can be imported using the id, e.g.

```
terraform import tencentcloud_vpc_end_point.end_point end_point_id
terraform import tencentcloud_vpc_end_point.example vpce-ntv3vy9k
```
12 changes: 6 additions & 6 deletions website/docs/r/vpc_end_point.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ layout: "tencentcloud"
page_title: "TencentCloud: tencentcloud_vpc_end_point"
sidebar_current: "docs-tencentcloud-resource-vpc_end_point"
description: |-
Provides a resource to create a vpc end_point
Provides a resource to create a VPC end point
---

# tencentcloud_vpc_end_point

Provides a resource to create a vpc end_point
Provides a resource to create a VPC end point

## Example Usage

```hcl
resource "tencentcloud_vpc_end_point" "end_point" {
resource "tencentcloud_vpc_end_point" "example" {
vpc_id = "vpc-391sv4w3"
subnet_id = "subnet-ljyn7h30"
end_point_name = "terraform-test"
end_point_name = "tf-example"
end_point_service_id = "vpcsvc-69y13tdb"
end_point_vip = "10.0.2.1"
Expand Down Expand Up @@ -53,9 +53,9 @@ In addition to all arguments above, the following attributes are exported:

## Import

vpc end_point can be imported using the id, e.g.
VPC end point can be imported using the id, e.g.

```
terraform import tencentcloud_vpc_end_point.end_point end_point_id
terraform import tencentcloud_vpc_end_point.example vpce-ntv3vy9k
```

0 comments on commit 488964d

Please sign in to comment.