Skip to content

Commit f7d6aad

Browse files
authored
change zone to optional (#2080)
* change zone to optional * update doc * update doc * update test
1 parent e78ddf6 commit f7d6aad

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

.changelog/2080.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: change `zone` to `optional`
3+
```

tencentcloud/resource_tc_vpn_gateway.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,9 @@ func resourceTencentCloudVpnGateway() *schema.Resource {
205205
},
206206
"zone": {
207207
Type: schema.TypeString,
208-
Required: true,
208+
Optional: true,
209209
ForceNew: true,
210+
Computed: true,
210211
Description: "Zone of the VPN gateway.",
211212
},
212213
"tags": {
@@ -234,8 +235,12 @@ func resourceTencentCloudVpnGatewayCreate(d *schema.ResourceData, meta interface
234235
bandwidth := d.Get("bandwidth").(int)
235236
bandwidth64 := uint64(bandwidth)
236237
request.InternetMaxBandwidthOut = &bandwidth64
237-
request.Zone = helper.String(d.Get("zone").(string))
238238
chargeType := d.Get("charge_type").(string)
239+
240+
if v, ok := d.GetOk("zone"); ok {
241+
request.Zone = helper.String(v.(string))
242+
}
243+
239244
//only support change renew_flag when charge type is pre-paid
240245
if chargeType == VPN_CHARGE_TYPE_PREPAID {
241246
var preChargePara vpc.InstanceChargePrepaid

tencentcloud/resource_tc_vpn_gateway_test.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func testSweepVpnGateway(region string) error {
6464
return nil
6565
}
6666

67-
func TestAccTencentCloudVpnGateway_basic(t *testing.T) {
67+
func TestAccTencentCloudVpnGatewayResource_basic(t *testing.T) {
6868
t.Parallel()
6969
resource.Test(t, resource.TestCase{
7070
PreCheck: func() { testAccPreCheck(t) },
@@ -206,7 +206,6 @@ resource "tencentcloud_vpn_gateway" "my_cgw" {
206206
name = "terraform_test"
207207
vpc_id = data.tencentcloud_vpc_instances.foo.instance_list.0.vpc_id
208208
bandwidth = 10
209-
zone = "ap-guangzhou-3"
210209
211210
tags = {
212211
test = "tf"
@@ -222,7 +221,6 @@ resource "tencentcloud_vpn_gateway" "my_cgw" {
222221
name = "terraform_update"
223222
vpc_id = data.tencentcloud_vpc_instances.foo.instance_list.0.vpc_id
224223
bandwidth = 5
225-
zone = "ap-guangzhou-3"
226224
227225
tags = {
228226
test = "test"
@@ -235,7 +233,6 @@ const testAccCcnVpnGatewayConfig = `
235233
resource "tencentcloud_vpn_gateway" "my_ccn_cgw" {
236234
name = "terraform_ccn_vpngw_test"
237235
bandwidth = 5
238-
zone = "ap-guangzhou-3"
239236
type = "CCN"
240237
241238
tags = {

website/docs/r/vpn_gateway.html.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ resource "tencentcloud_vpn_gateway" "my_cgw" {
9898
The following arguments are supported:
9999

100100
* `name` - (Required, String) Name of the VPN gateway. The length of character is limited to 1-60.
101-
* `zone` - (Required, String, ForceNew) Zone of the VPN gateway.
102101
* `bandwidth` - (Optional, Int) 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.
103102
* `cdc_id` - (Optional, String) CDC instance ID.
104103
* `charge_type` - (Optional, String) Charge Type of the VPN gateway. Valid value: `PREPAID`, `POSTPAID_BY_HOUR`. The default is `POSTPAID_BY_HOUR`.
@@ -108,6 +107,7 @@ The following arguments are supported:
108107
* `tags` - (Optional, Map) A list of tags used to associate different resources.
109108
* `type` - (Optional, String) Type of gateway instance, Default is `IPSEC`. Valid value: `IPSEC`, `SSL`, `CCN` and `SSL_CCN`.
110109
* `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.
110+
* `zone` - (Optional, String, ForceNew) Zone of the VPN gateway.
111111

112112
## Attributes Reference
113113

0 commit comments

Comments
 (0)