Skip to content

Commit bcbd7ff

Browse files
gitmknanonymous
andauthored
fix: support internet_max_bandwidth (#1551)
* fix: support internet_max_bandwidth * feat: add changelog --------- Co-authored-by: anonymous <anonymous@mail.org>
1 parent 9d96953 commit bcbd7ff

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

.changelog/1551.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 internet_max_bandwidth field
3+
```

tencentcloud/resource_tc_vpc_bandwidth_package.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ func resourceTencentCloudVpcBandwidthPackage() *schema.Resource {
6262
Description: "Bandwidth package name.",
6363
},
6464

65+
"internet_max_bandwidth": {
66+
Type: schema.TypeInt,
67+
Optional: true,
68+
Description: "Bandwidth packet speed limit size. Unit: Mbps, -1 means no speed limit.",
69+
},
70+
6571
"tags": {
6672
Type: schema.TypeMap,
6773
Optional: true,
@@ -94,6 +100,10 @@ func resourceTencentCloudVpcBandwidthPackageCreate(d *schema.ResourceData, meta
94100
request.BandwidthPackageName = helper.String(v.(string))
95101
}
96102

103+
if v, ok := d.GetOk("internet_max_bandwidth"); ok {
104+
request.InternetMaxBandwidth = helper.IntInt64(v.(int))
105+
}
106+
97107
if v := helper.GetTags(d, "tags"); len(v) > 0 {
98108
for tagKey, tagValue := range v {
99109
tag := vpc.Tag{
@@ -194,6 +204,10 @@ func resourceTencentCloudVpcBandwidthPackageRead(d *schema.ResourceData, meta in
194204
_ = d.Set("bandwidth_package_name", bandwidthPackage.BandwidthPackageName)
195205
}
196206

207+
if bandwidthPackage.Bandwidth != nil {
208+
_ = d.Set("internet_max_bandwidth", bandwidthPackage.Bandwidth)
209+
}
210+
197211
tcClient := meta.(*TencentCloudClient).apiV3Conn
198212
tagService := &TagService{client: tcClient}
199213
tags, err := tagService.DescribeResourceTags(ctx, "vpc", "bandwidthPackage", tcClient.Region, d.Id())
@@ -234,6 +248,10 @@ func resourceTencentCloudVpcBandwidthPackageUpdate(d *schema.ResourceData, meta
234248
return fmt.Errorf("`protocol` do not support change now.")
235249
}
236250

251+
if d.HasChange("internet_max_bandwidth") {
252+
return fmt.Errorf("`internet_max_bandwidth` do not support change now.")
253+
}
254+
237255
if d.HasChange("charge_type") {
238256
if v, ok := d.GetOk("charge_type"); ok {
239257
request.ChargeType = helper.String(v.(string))

website/docs/r/vpc_bandwidth_package.html.markdown

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ The following arguments are supported:
3030

3131
* `bandwidth_package_name` - (Optional, String) Bandwidth package name.
3232
* `charge_type` - (Optional, String) Bandwidth package billing type, default: TOP5_POSTPAID_BY_MONTH, optional value:- `TOP5_POSTPAID_BY_MONTH`: TOP5 billed by monthly postpaid- `PERCENT95_POSTPAID_BY_MONTH`: 95 billed monthly postpaid- `FIXED_PREPAID_BY_MONTH`: Monthly prepaid billing (Type FIXED_PREPAID_BY_MONTH product API capability is under construction).
33+
* `internet_max_bandwidth` - (Optional, Int) Bandwidth packet speed limit size. Unit: Mbps, -1 means no speed limit.
3334
* `network_type` - (Optional, String) Bandwidth packet type, default:BGP, optional:- `BGP`: common BGP shared bandwidth package- `HIGH_QUALITY_BGP`: Quality BGP Shared Bandwidth Package.
3435
* `tags` - (Optional, Map) Tag description list.
3536

0 commit comments

Comments
 (0)