Skip to content

Commit 0d3a9c4

Browse files
gitmknanonymous
andauthored
Fix/vpn validate (#1963)
* fix: delete validate * fix: delete validate * fix: deprecated tencentcloud_security_group * fix: modify vpn_connection * feat: add changelog * fix: update doc --------- Co-authored-by: anonymous <anonymous@mail.org>
1 parent 7ec3fd6 commit 0d3a9c4

File tree

5 files changed

+51
-57
lines changed

5 files changed

+51
-57
lines changed

.changelog/1963.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:deprecation
2+
tencentcloud_security_group_rule
3+
```

tencentcloud/resource_tc_security_group_rule.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
Provides a resource to create security group rule.
33
4-
~> **NOTE:** Single security rule is hardly ordered, use tencentcloud_security_group_lite_rule instead.
4+
~> **NOTE:** This resource will be offline and no longer supported, beacause single security rule is hardly ordered. Please use 'tencentcloud_security_group_lite_rule' instead.
55
66
Example Usage
77
@@ -69,9 +69,10 @@ import (
6969

7070
func resourceTencentCloudSecurityGroupRule() *schema.Resource {
7171
return &schema.Resource{
72-
Create: resourceTencentCloudSecurityGroupRuleCreate,
73-
Read: resourceTencentCloudSecurityGroupRuleRead,
74-
Delete: resourceTencentCloudSecurityGroupRuleDelete,
72+
DeprecationMessage: "This resource will be offline and no longer supported, beacause single security rule is hardly ordered. Please use 'tencentcloud_security_group_lite_rule' instead.",
73+
Create: resourceTencentCloudSecurityGroupRuleCreate,
74+
Read: resourceTencentCloudSecurityGroupRuleRead,
75+
Delete: resourceTencentCloudSecurityGroupRuleDelete,
7576

7677
Schema: map[string]*schema.Schema{
7778
"security_group_id": {

tencentcloud/resource_tc_vpn_connection.go

Lines changed: 39 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ import (
5454

5555
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
5656
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
57-
"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/errors"
5857
sdkErrors "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/errors"
5958
vpc "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vpc/v20170312"
6059
"github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/internal/helper"
@@ -132,39 +131,34 @@ func resourceTencentCloudVpnConnection() *schema.Resource {
132131
},
133132
},
134133
"ike_proto_encry_algorithm": {
135-
Type: schema.TypeString,
136-
Optional: true,
137-
Default: VPN_IKE_PROPO_ENCRY_ALGORITHM_3DESCBC,
138-
ValidateFunc: validateAllowedStringValue(VPN_IKE_PROPO_ENCRY_ALGORITHM),
139-
Description: "Proto encrypt algorithm of the IKE operation specification. Valid values: `3DES-CBC`, `AES-CBC-128`, `AES-CBC-128`, `AES-CBC-256`, `DES-CBC`. Default value is `3DES-CBC`.",
134+
Type: schema.TypeString,
135+
Optional: true,
136+
Default: VPN_IKE_PROPO_ENCRY_ALGORITHM_3DESCBC,
137+
Description: "Proto encrypt algorithm of the IKE operation specification. Valid values: `3DES-CBC`, `AES-CBC-128`, `AES-CBC-192`, `AES-CBC-256`, `DES-CBC`, `SM4`, `AES128GCM128`, `AES192GCM128`, `AES256GCM128`,`AES128GCM128`, `AES192GCM128`, `AES256GCM128`. Default value is `3DES-CBC`.",
140138
},
141139
"ike_proto_authen_algorithm": {
142-
Type: schema.TypeString,
143-
Optional: true,
144-
Default: VPN_IKE_PROPO_AUTHEN_ALGORITHM_MD5,
145-
ValidateFunc: validateAllowedStringValue(VPN_IKE_PROPO_AUTHEN_ALGORITHM),
146-
Description: "Proto authenticate algorithm of the IKE operation specification. Valid values: `MD5`, `SHA`, `SHA-256`. Default Value is `MD5`.",
140+
Type: schema.TypeString,
141+
Optional: true,
142+
Default: VPN_IKE_PROPO_AUTHEN_ALGORITHM_MD5,
143+
Description: "Proto authenticate algorithm of the IKE operation specification. Valid values: `MD5`, `SHA`, `SHA-256`. Default Value is `MD5`.",
147144
},
148145
"ike_exchange_mode": {
149-
Type: schema.TypeString,
150-
Optional: true,
151-
Default: VPN_IKE_EXCHANGE_MODE_MAIN,
152-
ValidateFunc: validateAllowedStringValue(VPN_IKE_EXCHANGE_MODE),
153-
Description: "Exchange mode of the IKE operation specification. Valid values: `AGGRESSIVE`, `MAIN`. Default value is `MAIN`.",
146+
Type: schema.TypeString,
147+
Optional: true,
148+
Default: VPN_IKE_EXCHANGE_MODE_MAIN,
149+
Description: "Exchange mode of the IKE operation specification. Valid values: `AGGRESSIVE`, `MAIN`. Default value is `MAIN`.",
154150
},
155151
"ike_local_identity": {
156-
Type: schema.TypeString,
157-
Optional: true,
158-
Default: VPN_IKE_IDENTITY_ADDRESS,
159-
ValidateFunc: validateAllowedStringValue(VPN_IKE_IDENTITY),
160-
Description: "Local identity way of IKE operation specification. Valid values: `ADDRESS`, `FQDN`. Default value is `ADDRESS`.",
152+
Type: schema.TypeString,
153+
Optional: true,
154+
Default: VPN_IKE_IDENTITY_ADDRESS,
155+
Description: "Local identity way of IKE operation specification. Valid values: `ADDRESS`, `FQDN`. Default value is `ADDRESS`.",
161156
},
162157
"ike_remote_identity": {
163-
Type: schema.TypeString,
164-
Optional: true,
165-
Default: VPN_IKE_IDENTITY_ADDRESS,
166-
ValidateFunc: validateAllowedStringValue(VPN_IKE_IDENTITY),
167-
Description: "Remote identity way of IKE operation specification. Valid values: `ADDRESS`, `FQDN`. Default value is `ADDRESS`.",
158+
Type: schema.TypeString,
159+
Optional: true,
160+
Default: VPN_IKE_IDENTITY_ADDRESS,
161+
Description: "Remote identity way of IKE operation specification. Valid values: `ADDRESS`, `FQDN`. Default value is `ADDRESS`.",
168162
},
169163
"ike_local_address": {
170164
Type: schema.TypeString,
@@ -191,11 +185,10 @@ func resourceTencentCloudVpnConnection() *schema.Resource {
191185
Description: "Remote FQDN name of the IKE operation specification.",
192186
},
193187
"ike_dh_group_name": {
194-
Type: schema.TypeString,
195-
Optional: true,
196-
Default: VPN_IKE_DH_GROUP_NAME_GROUP1,
197-
ValidateFunc: validateAllowedStringValue(VPN_IKE_DH_GROUP_NAME),
198-
Description: "DH group name of the IKE operation specification. Valid values: `GROUP1`, `GROUP2`, `GROUP5`, `GROUP14`, `GROUP24`. Default value is `GROUP1`.",
188+
Type: schema.TypeString,
189+
Optional: true,
190+
Default: VPN_IKE_DH_GROUP_NAME_GROUP1,
191+
Description: "DH group name of the IKE operation specification. Valid values: `GROUP1`, `GROUP2`, `GROUP5`, `GROUP14`, `GROUP24`. Default value is `GROUP1`.",
199192
},
200193
"ike_sa_lifetime_seconds": {
201194
Type: schema.TypeInt,
@@ -208,21 +201,19 @@ func resourceTencentCloudVpnConnection() *schema.Resource {
208201
Type: schema.TypeString,
209202
Optional: true,
210203
Default: "IKEV1",
211-
Description: "Version of the IKE operation specification. Default value is `IKEV1`.",
204+
Description: "Version of the IKE operation specification, values: `IKEV1`, `IKEV2`. Default value is `IKEV1`.",
212205
},
213206
"ipsec_encrypt_algorithm": {
214-
Type: schema.TypeString,
215-
Optional: true,
216-
Default: VPN_IPSEC_ENCRY_ALGORITHM_3DESCBC,
217-
ValidateFunc: validateAllowedStringValue(VPN_IPSEC_ENCRY_ALGORITHM),
218-
Description: "Encrypt algorithm of the IPSEC operation specification. Valid values: `3DES-CBC`, `AES-CBC-128`, `AES-CBC-128`, `AES-CBC-256`, `DES-CBC`. Default value is `3DES-CBC`.",
207+
Type: schema.TypeString,
208+
Optional: true,
209+
Default: VPN_IPSEC_ENCRY_ALGORITHM_3DESCBC,
210+
Description: "Encrypt algorithm of the IPSEC operation specification. Valid values: `3DES-CBC`, `AES-CBC-128`, `AES-CBC-192`, `AES-CBC-256`, `DES-CBC`, `SM4`, `NULL`, `AES128GCM128`, `AES192GCM128`, `AES256GCM128`. Default value is `3DES-CBC`.",
219211
},
220212
"ipsec_integrity_algorithm": {
221-
Type: schema.TypeString,
222-
Optional: true,
223-
Default: VPN_IPSEC_INTEGRITY_ALGORITHM_MD5,
224-
ValidateFunc: validateAllowedStringValue(VPN_IPSEC_INTEGRITY_ALGORITHM),
225-
Description: "Integrity algorithm of the IPSEC operation specification. Valid values: `SHA1`, `MD5`, `SHA-256`. Default value is `MD5`.",
213+
Type: schema.TypeString,
214+
Optional: true,
215+
Default: VPN_IPSEC_INTEGRITY_ALGORITHM_MD5,
216+
Description: "Integrity algorithm of the IPSEC operation specification. Valid values: `SHA1`, `MD5`, `SHA-256`. Default value is `MD5`.",
226217
},
227218
"ipsec_sa_lifetime_seconds": {
228219
Type: schema.TypeInt,
@@ -232,11 +223,10 @@ func resourceTencentCloudVpnConnection() *schema.Resource {
232223
Description: "SA lifetime of the IPSEC operation specification, unit is second. Valid value ranges: [180~604800]. Default value is 3600 seconds.",
233224
},
234225
"ipsec_pfs_dh_group": {
235-
Type: schema.TypeString,
236-
Optional: true,
237-
Default: "NULL",
238-
ValidateFunc: validateAllowedStringValue(VPN_IPSEC_PFS_DH_GROUP_NAME),
239-
Description: "PFS DH group. Valid value: `GROUP1`, `GROUP2`, `GROUP5`, `GROUP14`, `GROUP24`, `NULL`. Default value is `NULL`.",
226+
Type: schema.TypeString,
227+
Optional: true,
228+
Default: "NULL",
229+
Description: "PFS DH group. Valid value: `GROUP1`, `GROUP2`, `GROUP5`, `GROUP14`, `GROUP24`, `NULL`. Default value is `NULL`.",
240230
},
241231
"ipsec_sa_lifetime_traffic": {
242232
Type: schema.TypeInt,
@@ -907,7 +897,7 @@ func resourceTencentCloudVpnConnectionDelete(d *schema.ResourceData, meta interf
907897
err := resource.Retry(writeRetryTimeout, func() *resource.RetryError {
908898
_, e := meta.(*TencentCloudClient).apiV3Conn.UseVpcClient().DeleteVpnConnection(request)
909899
if e != nil {
910-
if ee, ok := e.(*errors.TencentCloudSDKError); ok {
900+
if ee, ok := e.(*sdkErrors.TencentCloudSDKError); ok {
911901
if ee.GetCode() == "UnsupportedOperation.InvalidState" {
912902
return resource.RetryableError(fmt.Errorf("state is not ready, wait to be `AVAILABLE`."))
913903
}
@@ -928,7 +918,7 @@ func resourceTencentCloudVpnConnectionDelete(d *schema.ResourceData, meta interf
928918
err = resource.Retry(readRetryTimeout, func() *resource.RetryError {
929919
result, e := meta.(*TencentCloudClient).apiV3Conn.UseVpcClient().DescribeVpnConnections(statRequest)
930920
if e != nil {
931-
ee, ok := e.(*errors.TencentCloudSDKError)
921+
ee, ok := e.(*sdkErrors.TencentCloudSDKError)
932922
if !ok {
933923
return retryError(e)
934924
}

website/docs/r/security_group_rule.html.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ description: |-
1111

1212
Provides a resource to create security group rule.
1313

14-
~> **NOTE:** Single security rule is hardly ordered, use tencentcloud_security_group_lite_rule instead.
14+
~> **NOTE:** This resource will be offline and no longer supported, beacause single security rule is hardly ordered. Please use 'tencentcloud_security_group_lite_rule' instead.
1515

1616
## Example Usage
1717

website/docs/r/vpn_connection.html.markdown

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,13 @@ The following arguments are supported:
6666
* `ike_local_fqdn_name` - (Optional, String) Local FQDN name of the IKE operation specification.
6767
* `ike_local_identity` - (Optional, String) Local identity way of IKE operation specification. Valid values: `ADDRESS`, `FQDN`. Default value is `ADDRESS`.
6868
* `ike_proto_authen_algorithm` - (Optional, String) Proto authenticate algorithm of the IKE operation specification. Valid values: `MD5`, `SHA`, `SHA-256`. Default Value is `MD5`.
69-
* `ike_proto_encry_algorithm` - (Optional, String) Proto encrypt algorithm of the IKE operation specification. Valid values: `3DES-CBC`, `AES-CBC-128`, `AES-CBC-128`, `AES-CBC-256`, `DES-CBC`. Default value is `3DES-CBC`.
69+
* `ike_proto_encry_algorithm` - (Optional, String) Proto encrypt algorithm of the IKE operation specification. Valid values: `3DES-CBC`, `AES-CBC-128`, `AES-CBC-192`, `AES-CBC-256`, `DES-CBC`, `SM4`, `AES128GCM128`, `AES192GCM128`, `AES256GCM128`,`AES128GCM128`, `AES192GCM128`, `AES256GCM128`. Default value is `3DES-CBC`.
7070
* `ike_remote_address` - (Optional, String) Remote address of IKE operation specification, valid when ike_remote_identity is `ADDRESS`, generally the value is `public_ip_address` of the related customer gateway.
7171
* `ike_remote_fqdn_name` - (Optional, String) Remote FQDN name of the IKE operation specification.
7272
* `ike_remote_identity` - (Optional, String) Remote identity way of IKE operation specification. Valid values: `ADDRESS`, `FQDN`. Default value is `ADDRESS`.
7373
* `ike_sa_lifetime_seconds` - (Optional, Int) SA lifetime of the IKE operation specification, unit is `second`. The value ranges from 60 to 604800. Default value is 86400 seconds.
74-
* `ike_version` - (Optional, String) Version of the IKE operation specification. Default value is `IKEV1`.
75-
* `ipsec_encrypt_algorithm` - (Optional, String) Encrypt algorithm of the IPSEC operation specification. Valid values: `3DES-CBC`, `AES-CBC-128`, `AES-CBC-128`, `AES-CBC-256`, `DES-CBC`. Default value is `3DES-CBC`.
74+
* `ike_version` - (Optional, String) Version of the IKE operation specification, values: `IKEV1`, `IKEV2`. Default value is `IKEV1`.
75+
* `ipsec_encrypt_algorithm` - (Optional, String) Encrypt algorithm of the IPSEC operation specification. Valid values: `3DES-CBC`, `AES-CBC-128`, `AES-CBC-192`, `AES-CBC-256`, `DES-CBC`, `SM4`, `NULL`, `AES128GCM128`, `AES192GCM128`, `AES256GCM128`. Default value is `3DES-CBC`.
7676
* `ipsec_integrity_algorithm` - (Optional, String) Integrity algorithm of the IPSEC operation specification. Valid values: `SHA1`, `MD5`, `SHA-256`. Default value is `MD5`.
7777
* `ipsec_pfs_dh_group` - (Optional, String) PFS DH group. Valid value: `GROUP1`, `GROUP2`, `GROUP5`, `GROUP14`, `GROUP24`, `NULL`. Default value is `NULL`.
7878
* `ipsec_sa_lifetime_seconds` - (Optional, Int) SA lifetime of the IPSEC operation specification, unit is second. Valid value ranges: [180~604800]. Default value is 3600 seconds.

0 commit comments

Comments
 (0)