Skip to content

Commit 53f223e

Browse files
authored
add ssl ccn vpn gateway (#1919)
* add ssl ccn vpn gateway * add changelog
1 parent 1d8821a commit 53f223e

File tree

3 files changed

+99
-7
lines changed

3 files changed

+99
-7
lines changed

.changelog/1919.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
resource/tencentcloud_vpn_gateway: support create `SSL_CCN` vpn gateway
3+
```

tencentcloud/resource_tc_vpn_gateway.go

Lines changed: 48 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,49 @@ Provides a resource to create a VPN gateway.
55
66
Example Usage
77
8+
VPC SSL VPN gateway
9+
```hcl
10+
resource "tencentcloud_vpn_gateway" "my_cgw" {
11+
name = "test"
12+
bandwidth = 5
13+
zone = "ap-guangzhou-3"
14+
type = "SSL"
15+
vpc_id = "vpc-86v957zb"
16+
17+
tags = {
18+
test = "test"
19+
}
20+
}
21+
```
22+
23+
CCN IPEC VPN gateway
24+
```hcl
25+
resource "tencentcloud_vpn_gateway" "my_cgw" {
26+
name = "test"
27+
bandwidth = 5
28+
zone = "ap-guangzhou-3"
29+
type = "CCN"
30+
31+
tags = {
32+
test = "test"
33+
}
34+
}
35+
```
36+
37+
CCN SSL VPN gateway
38+
```hcl
39+
resource "tencentcloud_vpn_gateway" "my_cgw" {
40+
name = "test"
41+
bandwidth = 5
42+
zone = "ap-guangzhou-3"
43+
type = "SSL_CCN"
44+
45+
tags = {
46+
test = "test"
47+
}
48+
}
49+
```
50+
851
POSTPAID_BY_HOUR VPN gateway
952
```hcl
1053
resource "tencentcloud_vpn_gateway" "my_cgw" {
@@ -80,12 +123,12 @@ func resourceTencentCloudVpnGateway() *schema.Resource {
80123
Optional: true,
81124
ForceNew: true,
82125
DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {
83-
if v, ok := d.GetOk("type"); ok && v.(string) == "CCN" {
126+
if v, ok := d.GetOk("type"); ok && (v.(string) == "CCN" || v.(string) == "SSL_CCN") {
84127
return true
85128
}
86129
return old == new
87130
},
88-
Description: "ID of the VPC. Required if vpn gateway is not in `CCN` type, and doesn't make sense for `CCN` vpn gateway.",
131+
Description: "ID of the VPC. Required if vpn gateway is not in `CCN` or `SSL_CCN` type, and doesn't make sense for `CCN` or `SSL_CCN` vpn gateway.",
89132
},
90133
"bandwidth": {
91134
Type: schema.TypeInt,
@@ -102,7 +145,7 @@ func resourceTencentCloudVpnGateway() *schema.Resource {
102145
Type: schema.TypeString,
103146
Computed: true,
104147
Optional: true,
105-
Description: "Type of gateway instance. Valid value: `IPSEC`, `SSL` and `CCN`. Note: CCN type is only for whitelist customer now.",
148+
Description: "Type of gateway instance, Default is `IPSEC`. Valid value: `IPSEC`, `SSL`, `CCN` and `SSL_CCN`.",
106149
},
107150
"state": {
108151
Type: schema.TypeString,
@@ -203,7 +246,7 @@ func resourceTencentCloudVpnGatewayCreate(d *schema.ResourceData, meta interface
203246
request.InstanceChargeType = &chargeType
204247
if v, ok := d.GetOk("type"); ok {
205248
request.Type = helper.String(v.(string))
206-
if v.(string) != "CCN" {
249+
if v.(string) != "CCN" && v.(string) != "SSL_CCN" {
207250
if _, ok := d.GetOk("vpc_id"); !ok {
208251
return fmt.Errorf("[CRITAL] vpc_id is required for vpn gateway in %s type", v.(string))
209252
}
@@ -216,7 +259,7 @@ func resourceTencentCloudVpnGatewayCreate(d *schema.ResourceData, meta interface
216259
}
217260
} else {
218261
if _, ok := d.GetOk("vpc_id"); !ok {
219-
return fmt.Errorf("[CRITAL] vpc_id is required for vpn gateway in %s type", v.(string))
262+
return fmt.Errorf("[CRITAL] vpc_id is required for vpn gateway in %s type", "IPSEC")
220263
}
221264
request.VpcId = helper.String(d.Get("vpc_id").(string))
222265
}

website/docs/r/vpn_gateway.html.markdown

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,52 @@ Provides a resource to create a VPN gateway.
1515

1616
## Example Usage
1717

18+
VPC SSL VPN gateway
19+
20+
```hcl
21+
resource "tencentcloud_vpn_gateway" "my_cgw" {
22+
name = "test"
23+
bandwidth = 5
24+
zone = "ap-guangzhou-3"
25+
type = "SSL"
26+
vpc_id = "vpc-86v957zb"
27+
28+
tags = {
29+
test = "test"
30+
}
31+
}
32+
```
33+
34+
CCN IPEC VPN gateway
35+
36+
```hcl
37+
resource "tencentcloud_vpn_gateway" "my_cgw" {
38+
name = "test"
39+
bandwidth = 5
40+
zone = "ap-guangzhou-3"
41+
type = "CCN"
42+
43+
tags = {
44+
test = "test"
45+
}
46+
}
47+
```
48+
49+
CCN SSL VPN gateway
50+
51+
```hcl
52+
resource "tencentcloud_vpn_gateway" "my_cgw" {
53+
name = "test"
54+
bandwidth = 5
55+
zone = "ap-guangzhou-3"
56+
type = "SSL_CCN"
57+
58+
tags = {
59+
test = "test"
60+
}
61+
}
62+
```
63+
1864
POSTPAID_BY_HOUR VPN gateway
1965

2066
```hcl
@@ -60,8 +106,8 @@ The following arguments are supported:
60106
* `prepaid_period` - (Optional, Int) 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 changed on `IPSEC` vpn gateway.
61107
* `prepaid_renew_flag` - (Optional, String) Flag indicates whether to renew or not. Valid value: `NOTIFY_AND_AUTO_RENEW`, `NOTIFY_AND_MANUAL_RENEW`.
62108
* `tags` - (Optional, Map) A list of tags used to associate different resources.
63-
* `type` - (Optional, String) Type of gateway instance. Valid value: `IPSEC`, `SSL` and `CCN`. Note: CCN type is only for whitelist customer now.
64-
* `vpc_id` - (Optional, String, ForceNew) ID of the VPC. Required if vpn gateway is not in `CCN` type, and doesn't make sense for `CCN` vpn gateway.
109+
* `type` - (Optional, String) Type of gateway instance, Default is `IPSEC`. Valid value: `IPSEC`, `SSL`, `CCN` and `SSL_CCN`.
110+
* `vpc_id` - (Optional, String, ForceNew) ID of the VPC. Required if vpn gateway is not in `CCN` or `SSL_CCN` type, and doesn't make sense for `CCN` or `SSL_CCN` vpn gateway.
65111

66112
## Attributes Reference
67113

0 commit comments

Comments
 (0)