Skip to content

Commit b23eb30

Browse files
authored
support set vip isp (#2344)
* support set vip isp * add changelog
1 parent e08154e commit b23eb30

File tree

3 files changed

+67
-4
lines changed

3 files changed

+67
-4
lines changed

.changelog/2344.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
tencentcloud_clb_instance: Support set `vip_isp`.
3+
```

tencentcloud/resource_tc_clb_instance.go

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,36 @@ resource "tencentcloud_clb_instance" "open_clb" {
5454
}
5555
```
5656
57+
OPNE CLB with VipIsp
58+
59+
```hcl
60+
resource "tencentcloud_vpc_bandwidth_package" "example" {
61+
network_type = "SINGLEISP_CMCC"
62+
charge_type = "ENHANCED95_POSTPAID_BY_MONTH"
63+
bandwidth_package_name = "tf-example"
64+
internet_max_bandwidth = 300
65+
egress = "center_egress1"
66+
67+
tags = {
68+
"createdBy" = "terraform"
69+
}
70+
}
71+
72+
resource "tencentcloud_clb_instance" "open_clb" {
73+
network_type = "OPEN"
74+
clb_name = "my-open-clb"
75+
project_id = 0
76+
vpc_id = "vpc-4owdpnwr"
77+
vip_isp = "CMCC"
78+
internet_charge_type = "BANDWIDTH_PACKAGE"
79+
bandwidth_package_id = tencentcloud_vpc_bandwidth_package.example.id
80+
81+
tags = {
82+
test = "open"
83+
}
84+
}
85+
```
86+
5787
Dynamic Vip Instance
5888
5989
```hcl
@@ -354,6 +384,8 @@ func resourceTencentCloudClbInstance() *schema.Resource {
354384
},
355385
"vip_isp": {
356386
Type: schema.TypeString,
387+
Optional: true,
388+
ForceNew: true,
357389
Computed: true,
358390
Description: "Network operator, only applicable to open CLB. Valid values are `CMCC`(China Mobile), `CTCC`(Telecom), `CUCC`(China Unicom) and `BGP`. If this ISP is specified, network billing method can only use the bandwidth package billing (BANDWIDTH_PACKAGE).",
359391
},
@@ -512,12 +544,10 @@ func resourceTencentCloudClbInstanceCreate(d *schema.ResourceData, meta interfac
512544
request.InternetAccessible.InternetMaxBandwidthOut = helper.IntInt64(bv.(int))
513545
}
514546
if pok {
515-
if pok && chargeType != INTERNET_CHARGE_TYPE_BANDWIDTH_PACKAGE {
547+
if chargeType != INTERNET_CHARGE_TYPE_BANDWIDTH_PACKAGE {
516548
return fmt.Errorf("[CHECK][CLB instance][Create] check: internet_charge_type must `BANDWIDTH_PACKAGE` when bandwidth_package_id was set")
517549
}
518550
request.BandwidthPackageId = helper.String(pv.(string))
519-
} else if chargeType == INTERNET_CHARGE_TYPE_BANDWIDTH_PACKAGE {
520-
return fmt.Errorf("[CHECK][CLB instance][Create] check: the `bandwidth_package_id` must be specified if internet_charge_type was `BANDWIDTH_PACKAGE`")
521551
}
522552
}
523553

website/docs/r/clb_instance.html.markdown

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,36 @@ resource "tencentcloud_clb_instance" "open_clb" {
6464
}
6565
```
6666

67+
### OPNE CLB with VipIsp
68+
69+
```hcl
70+
resource "tencentcloud_vpc_bandwidth_package" "example" {
71+
network_type = "SINGLEISP_CMCC"
72+
charge_type = "ENHANCED95_POSTPAID_BY_MONTH"
73+
bandwidth_package_name = "tf-example"
74+
internet_max_bandwidth = 300
75+
egress = "center_egress1"
76+
77+
tags = {
78+
"createdBy" = "terraform"
79+
}
80+
}
81+
82+
resource "tencentcloud_clb_instance" "open_clb" {
83+
network_type = "OPEN"
84+
clb_name = "my-open-clb"
85+
project_id = 0
86+
vpc_id = "vpc-4owdpnwr"
87+
vip_isp = "CMCC"
88+
internet_charge_type = "BANDWIDTH_PACKAGE"
89+
bandwidth_package_id = tencentcloud_vpc_bandwidth_package.example.id
90+
91+
tags = {
92+
test = "open"
93+
}
94+
}
95+
```
96+
6797
### Dynamic Vip Instance
6898

6999
```hcl
@@ -222,6 +252,7 @@ The following arguments are supported:
222252
* `tags` - (Optional, Map) The available tags within this CLB.
223253
* `target_region_info_region` - (Optional, String) Region information of backend services are attached the CLB instance. Only supports `OPEN` CLBs.
224254
* `target_region_info_vpc_id` - (Optional, String) Vpc information of backend services are attached the CLB instance. Only supports `OPEN` CLBs.
255+
* `vip_isp` - (Optional, String, ForceNew) Network operator, only applicable to open CLB. Valid values are `CMCC`(China Mobile), `CTCC`(Telecom), `CUCC`(China Unicom) and `BGP`. If this ISP is specified, network billing method can only use the bandwidth package billing (BANDWIDTH_PACKAGE).
225256
* `vpc_id` - (Optional, String, ForceNew) VPC ID of the CLB.
226257
* `zone_id` - (Optional, String) Available zone id, only applicable to open CLB.
227258

@@ -237,7 +268,6 @@ In addition to all arguments above, the following attributes are exported:
237268
* `id` - ID of the resource.
238269
* `clb_vips` - The virtual service address table of the CLB.
239270
* `domain` - Domain name of the CLB instance.
240-
* `vip_isp` - Network operator, only applicable to open CLB. Valid values are `CMCC`(China Mobile), `CTCC`(Telecom), `CUCC`(China Unicom) and `BGP`. If this ISP is specified, network billing method can only use the bandwidth package billing (BANDWIDTH_PACKAGE).
241271

242272

243273
## Import

0 commit comments

Comments
 (0)