Skip to content

Commit dca3432

Browse files
authored
update bgp (#2001)
* update bgp * update changelog
1 parent 4b15e17 commit dca3432

File tree

3 files changed

+49
-1
lines changed

3 files changed

+49
-1
lines changed

.changelog/2001.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_vpc_bandwidth_package: support set `time_span`
3+
```

tencentcloud/resource_tc_vpc_bandwidth_package.go

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,23 @@ resource "tencentcloud_vpc_bandwidth_package" "bandwidth_package" {
1212
"createdBy" = "terraform"
1313
}
1414
}
15-
1615
```
16+
17+
PrePaid Bandwidth Package
18+
19+
```hcl
20+
resource "tencentcloud_vpc_bandwidth_package" "bandwidth_package" {
21+
network_type = "BGP"
22+
charge_type = "FIXED_PREPAID_BY_MONTH"
23+
bandwidth_package_name = "test-001"
24+
time_span = 3
25+
internet_max_bandwidth = 100
26+
tags = {
27+
"createdBy" = "terraform"
28+
}
29+
}
30+
````
31+
1732
Import
1833
1934
vpc bandwidth_package can be imported using the id, e.g.
@@ -76,6 +91,12 @@ func resourceTencentCloudVpcBandwidthPackage() *schema.Resource {
7691
Optional: true,
7792
Description: "Tag description list.",
7893
},
94+
95+
"time_span": {
96+
Type: schema.TypeInt,
97+
Optional: true,
98+
Description: "The purchase duration of the prepaid monthly bandwidth package, unit: month, value range: 1~60.",
99+
},
79100
},
80101
}
81102
}
@@ -117,6 +138,10 @@ func resourceTencentCloudVpcBandwidthPackageCreate(d *schema.ResourceData, meta
117138
}
118139
}
119140

141+
if v, ok := d.GetOkExists("time_span"); ok {
142+
request.TimeSpan = helper.IntUint64(v.(int))
143+
}
144+
120145
err := resource.Retry(writeRetryTimeout, func() *resource.RetryError {
121146
result, e := meta.(*TencentCloudClient).apiV3Conn.UseVpcClient().CreateBandwidthPackage(request)
122147
if e != nil {
@@ -255,6 +280,10 @@ func resourceTencentCloudVpcBandwidthPackageUpdate(d *schema.ResourceData, meta
255280
return fmt.Errorf("`internet_max_bandwidth` do not support change now.")
256281
}
257282

283+
if d.HasChange("time_span") {
284+
return fmt.Errorf("`time_span` do not support change now.")
285+
}
286+
258287
if d.HasChange("charge_type") {
259288
if v, ok := d.GetOk("charge_type"); ok {
260289
request.ChargeType = helper.String(v.(string))

website/docs/r/vpc_bandwidth_package.html.markdown

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,21 @@ resource "tencentcloud_vpc_bandwidth_package" "bandwidth_package" {
2424
}
2525
```
2626

27+
### PrePaid Bandwidth Package
28+
29+
```hcl
30+
resource "tencentcloud_vpc_bandwidth_package" "bandwidth_package" {
31+
network_type = "BGP"
32+
charge_type = "FIXED_PREPAID_BY_MONTH"
33+
bandwidth_package_name = "test-001"
34+
time_span = 3
35+
internet_max_bandwidth = 100
36+
tags = {
37+
"createdBy" = "terraform"
38+
}
39+
}
40+
```
41+
2742
## Argument Reference
2843

2944
The following arguments are supported:
@@ -33,6 +48,7 @@ The following arguments are supported:
3348
* `internet_max_bandwidth` - (Optional, Int) Bandwidth packet speed limit size. Unit: Mbps, -1 means no speed limit.
3449
* `network_type` - (Optional, String) Bandwidth packet type, default:BGP, optional:- `BGP`: common BGP shared bandwidth package- `HIGH_QUALITY_BGP`: Quality BGP Shared Bandwidth Package.
3550
* `tags` - (Optional, Map) Tag description list.
51+
* `time_span` - (Optional, Int) The purchase duration of the prepaid monthly bandwidth package, unit: month, value range: 1~60.
3652

3753
## Attributes Reference
3854

0 commit comments

Comments
 (0)