Skip to content

Commit 0d10984

Browse files
authored
vpngw add max connection (#1052)
1 parent 9fb6a63 commit 0d10984

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

tencentcloud/resource_tc_vpn_gateway.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,18 @@ func resourceTencentCloudVpnGateway() *schema.Resource {
128128
Default: VPN_CHARGE_TYPE_POSTPAID_BY_HOUR,
129129
Description: "Charge Type of the VPN gateway. Valid value: `PREPAID`, `POSTPAID_BY_HOUR`. The default is `POSTPAID_BY_HOUR`.",
130130
},
131+
"cdc_id": {
132+
Type: schema.TypeString,
133+
Optional: true,
134+
Computed: true,
135+
Description: "CDC instance ID.",
136+
},
137+
"max_connection": {
138+
Type: schema.TypeInt,
139+
Optional: true,
140+
Computed: true,
141+
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.",
142+
},
131143
"expired_time": {
132144
Type: schema.TypeString,
133145
Computed: true,
@@ -208,6 +220,15 @@ func resourceTencentCloudVpnGatewayCreate(d *schema.ResourceData, meta interface
208220
}
209221
request.VpcId = helper.String(d.Get("vpc_id").(string))
210222
}
223+
224+
if v, ok := d.GetOk("cdc_id"); ok {
225+
request.CdcId = helper.String(v.(string))
226+
}
227+
228+
if v, ok := d.GetOk("max_connection"); ok {
229+
request.MaxConnection = helper.IntUint64(v.(int))
230+
}
231+
211232
var response *vpc.CreateVpnGatewayResponse
212233
err := resource.Retry(readRetryTimeout, func() *resource.RetryError {
213234
result, e := meta.(*TencentCloudClient).apiV3Conn.UseVpcClient().CreateVpnGateway(request)
@@ -306,6 +327,8 @@ func resourceTencentCloudVpnGatewayRead(d *schema.ResourceData, meta interface{}
306327
_ = d.Set("new_purchase_plan", gateway.NewPurchasePlan)
307328
_ = d.Set("restrict_state", gateway.RestrictState)
308329
_ = d.Set("zone", gateway.Zone)
330+
_ = d.Set("cdc_id", gateway.CdcId)
331+
_ = d.Set("max_connection", gateway.MaxConnection)
309332
//tags
310333
tagService := TagService{client: meta.(*TencentCloudClient).apiV3Conn}
311334
region := meta.(*TencentCloudClient).apiV3Conn.Region
@@ -412,6 +435,10 @@ func resourceTencentCloudVpnGatewayUpdate(d *schema.ResourceData, meta interface
412435
d.SetPartial("tags")
413436
}
414437

438+
if d.HasChange("cdc_id") || d.HasChange("max_connection") {
439+
return fmt.Errorf("cdc_id and max_connection do not support change now.")
440+
}
441+
415442
d.Partial(false)
416443

417444
return resourceTencentCloudVpnGatewayRead(d, meta)

website/docs/r/vpn_gateway.html.markdown

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ The following arguments are supported:
5454
* `name` - (Required) Name of the VPN gateway. The length of character is limited to 1-60.
5555
* `zone` - (Required, ForceNew) Zone of the VPN gateway.
5656
* `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.
57+
* `cdc_id` - (Optional) CDC instance ID.
5758
* `charge_type` - (Optional) Charge Type of the VPN gateway. Valid value: `PREPAID`, `POSTPAID_BY_HOUR`. The default is `POSTPAID_BY_HOUR`.
59+
* `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.
5860
* `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.
5961
* `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.
6062
* `tags` - (Optional) A list of tags used to associate different resources.

0 commit comments

Comments
 (0)