Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions tencentcloud/resource_tc_vpn_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,18 @@ func resourceTencentCloudVpnGateway() *schema.Resource {
Default: VPN_CHARGE_TYPE_POSTPAID_BY_HOUR,
Description: "Charge Type of the VPN gateway. Valid value: `PREPAID`, `POSTPAID_BY_HOUR`. The default is `POSTPAID_BY_HOUR`.",
},
"cdc_id": {
Type: schema.TypeString,
Optional: true,
Computed: true,
Description: "CDC instance ID.",
},
"max_connection": {
Type: schema.TypeInt,
Optional: true,
Computed: true,
Description: "Maximum number of connected clients allowed for the SSL VPN gateway. Valid values: [5, 10, 20, 50, 100]. This parameter is only required for SSL VPN gateways.",
},
"expired_time": {
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -208,6 +220,15 @@ func resourceTencentCloudVpnGatewayCreate(d *schema.ResourceData, meta interface
}
request.VpcId = helper.String(d.Get("vpc_id").(string))
}

if v, ok := d.GetOk("cdc_id"); ok {
request.CdcId = helper.String(v.(string))
}

if v, ok := d.GetOk("max_connection"); ok {
request.MaxConnection = helper.IntUint64(v.(int))
}

var response *vpc.CreateVpnGatewayResponse
err := resource.Retry(readRetryTimeout, func() *resource.RetryError {
result, e := meta.(*TencentCloudClient).apiV3Conn.UseVpcClient().CreateVpnGateway(request)
Expand Down Expand Up @@ -306,6 +327,8 @@ func resourceTencentCloudVpnGatewayRead(d *schema.ResourceData, meta interface{}
_ = d.Set("new_purchase_plan", gateway.NewPurchasePlan)
_ = d.Set("restrict_state", gateway.RestrictState)
_ = d.Set("zone", gateway.Zone)
_ = d.Set("cdc_id", gateway.CdcId)
_ = d.Set("max_connection", gateway.MaxConnection)
//tags
tagService := TagService{client: meta.(*TencentCloudClient).apiV3Conn}
region := meta.(*TencentCloudClient).apiV3Conn.Region
Expand Down Expand Up @@ -412,6 +435,10 @@ func resourceTencentCloudVpnGatewayUpdate(d *schema.ResourceData, meta interface
d.SetPartial("tags")
}

if d.HasChange("cdc_id") || d.HasChange("max_connection") {
return fmt.Errorf("cdc_id and max_connection do not support change now.")
}

d.Partial(false)

return resourceTencentCloudVpnGatewayRead(d, meta)
Expand Down
2 changes: 2 additions & 0 deletions website/docs/r/vpn_gateway.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ The following arguments are supported:
* `name` - (Required) Name of the VPN gateway. The length of character is limited to 1-60.
* `zone` - (Required, ForceNew) Zone of the VPN gateway.
* `bandwidth` - (Optional) The maximum public network output bandwidth of VPN gateway (unit: Mbps), the available values include: 5,10,20,50,100,200,500,1000. Default is 5. When charge type is `PREPAID`, bandwidth degradation operation is unsupported.
* `cdc_id` - (Optional) CDC instance ID.
* `charge_type` - (Optional) Charge Type of the VPN gateway. Valid value: `PREPAID`, `POSTPAID_BY_HOUR`. The default is `POSTPAID_BY_HOUR`.
* `max_connection` - (Optional) Maximum number of connected clients allowed for the SSL VPN gateway. Valid values: [5, 10, 20, 50, 100]. This parameter is only required for SSL VPN gateways.
* `prepaid_period` - (Optional) Period of instance to be prepaid. Valid value: `1`, `2`, `3`, `4`, `6`, `7`, `8`, `9`, `12`, `24`, `36`. The unit is month. Caution: when this para and renew_flag para are valid, the request means to renew several months more pre-paid period. This para can only be set to take effect in create operation.
* `prepaid_renew_flag` - (Optional) Flag indicates whether to renew or not. Valid value: `NOTIFY_AND_RENEW`, `NOTIFY_AND_AUTO_RENEW`, `NOT_NOTIFY_AND_NOT_RENEW`. This para can only be set to take effect in create operation.
* `tags` - (Optional) A list of tags used to associate different resources.
Expand Down