Skip to content

Commit f3f8ec6

Browse files
committed
add
1 parent e9ecd6b commit f3f8ec6

File tree

3 files changed

+64
-19
lines changed

3 files changed

+64
-19
lines changed

tencentcloud/services/teo/resource_tc_teo_l7_acc_rule.md

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
Provides a resource to create a teo l7_acc_rule
1+
Provides a resource to create a TEO l7 acc rule
22

33
~> **NOTE:** This feature only supports the sites in the plans of the Standard Edition and the Enterprise Edition.
44

55
Example Usage
66

77
```hcl
8-
resource "tencentcloud_teo_l7_acc_rule" "teo_l7_acc_rule" {
8+
resource "tencentcloud_teo_l7_acc_rule" "example" {
99
zone_id = "zone-36bjhygh1bxe"
1010
rules {
1111
description = ["1"]
@@ -22,6 +22,7 @@ resource "tencentcloud_teo_l7_acc_rule" "teo_l7_acc_rule" {
2222
}
2323
}
2424
}
25+
2526
actions {
2627
name = "CacheKey"
2728
cache_key_parameters {
@@ -35,6 +36,7 @@ resource "tencentcloud_teo_l7_acc_rule" "teo_l7_acc_rule" {
3536
}
3637
}
3738
}
39+
3840
sub_rules {
3941
description = ["1-1"]
4042
branches {
@@ -49,6 +51,7 @@ resource "tencentcloud_teo_l7_acc_rule" "teo_l7_acc_rule" {
4951
}
5052
}
5153
}
54+
5255
sub_rules {
5356
description = ["1-2"]
5457
branches {
@@ -64,6 +67,7 @@ resource "tencentcloud_teo_l7_acc_rule" "teo_l7_acc_rule" {
6467
}
6568
}
6669
}
70+
6771
rules {
6872
description = ["2"]
6973
rule_name = "音视频直播"
@@ -84,6 +88,7 @@ resource "tencentcloud_teo_l7_acc_rule" "teo_l7_acc_rule" {
8488
}
8589
}
8690
}
91+
8792
branches {
8893
condition = "$${http.request.file_extension} in ['ts', 'mp4', 'm4a', 'm4s']"
8994
actions {
@@ -97,6 +102,7 @@ resource "tencentcloud_teo_l7_acc_rule" "teo_l7_acc_rule" {
97102
}
98103
}
99104
}
105+
100106
branches {
101107
condition = "*"
102108
actions {
@@ -114,6 +120,7 @@ resource "tencentcloud_teo_l7_acc_rule" "teo_l7_acc_rule" {
114120
}
115121
}
116122
}
123+
117124
rules {
118125
description = ["3"]
119126
rule_name = "大文件下载"
@@ -129,6 +136,7 @@ resource "tencentcloud_teo_l7_acc_rule" "teo_l7_acc_rule" {
129136
}
130137
}
131138
}
139+
132140
actions {
133141
name = "CacheKey"
134142
cache_key_parameters {
@@ -142,12 +150,14 @@ resource "tencentcloud_teo_l7_acc_rule" "teo_l7_acc_rule" {
142150
}
143151
}
144152
}
153+
145154
actions {
146155
name = "RangeOriginPull"
147156
range_origin_pull_parameters {
148157
switch = "on"
149158
}
150159
}
160+
151161
sub_rules {
152162
description = ["3-1"]
153163
branches {
@@ -164,6 +174,7 @@ resource "tencentcloud_teo_l7_acc_rule" "teo_l7_acc_rule" {
164174
}
165175
}
166176
}
177+
167178
rules {
168179
description = ["4"]
169180
rule_name = "音视频点播"
@@ -179,6 +190,7 @@ resource "tencentcloud_teo_l7_acc_rule" "teo_l7_acc_rule" {
179190
}
180191
}
181192
}
193+
182194
actions {
183195
name = "CacheKey"
184196
cache_key_parameters {
@@ -192,12 +204,14 @@ resource "tencentcloud_teo_l7_acc_rule" "teo_l7_acc_rule" {
192204
}
193205
}
194206
}
207+
195208
actions {
196209
name = "RangeOriginPull"
197210
range_origin_pull_parameters {
198211
switch = "on"
199212
}
200213
}
214+
201215
sub_rules {
202216
description = ["4-1"]
203217
branches {
@@ -214,6 +228,7 @@ resource "tencentcloud_teo_l7_acc_rule" "teo_l7_acc_rule" {
214228
}
215229
}
216230
}
231+
217232
rules {
218233
description = ["5"]
219234
rule_name = "API 加速"
@@ -227,6 +242,7 @@ resource "tencentcloud_teo_l7_acc_rule" "teo_l7_acc_rule" {
227242
}
228243
}
229244
}
245+
230246
actions {
231247
name = "SmartRouting"
232248
smart_routing_parameters {
@@ -235,6 +251,7 @@ resource "tencentcloud_teo_l7_acc_rule" "teo_l7_acc_rule" {
235251
}
236252
}
237253
}
254+
238255
rules {
239256
description = ["6"]
240257
rule_name = "WordPress 建站"
@@ -255,6 +272,7 @@ resource "tencentcloud_teo_l7_acc_rule" "teo_l7_acc_rule" {
255272
}
256273
}
257274
}
275+
258276
branches {
259277
condition = "$${http.request.uri.path} in ['/']"
260278
actions {
@@ -266,6 +284,7 @@ resource "tencentcloud_teo_l7_acc_rule" "teo_l7_acc_rule" {
266284
}
267285
}
268286
}
287+
269288
branches {
270289
condition = "$${http.request.file_extension} in ['aspx', 'jsp', 'php', 'asp', 'do', 'dwr', 'cgi', 'fcgi', 'action', 'ashx', 'axd']"
271290
actions {
@@ -277,6 +296,7 @@ resource "tencentcloud_teo_l7_acc_rule" "teo_l7_acc_rule" {
277296
}
278297
}
279298
}
299+
280300
branches {
281301
condition = "$${http.request.uri.path} in ['/wp-admin/']"
282302
actions {
@@ -288,6 +308,7 @@ resource "tencentcloud_teo_l7_acc_rule" "teo_l7_acc_rule" {
288308
}
289309
}
290310
}
311+
291312
branches {
292313
condition = "*"
293314
actions {
@@ -306,11 +327,11 @@ resource "tencentcloud_teo_l7_acc_rule" "teo_l7_acc_rule" {
306327
}
307328
}
308329
}
309-
310330
```
331+
311332
Import
312333

313-
teo l7_acc_rule can be imported using the zone_id, e.g.
334+
TEO l7 acc rule can be imported using the zone_id, e.g.
335+
````
336+
terraform import tencentcloud_teo_l7_acc_rule.example zone-297z8rf93cfw
314337
````
315-
terraform import tencentcloud_teo_l7_acc_rule.teo_l7_acc_rule zone-297z8rf93cfw
316-
````

tencentcloud/services/teo/resource_tc_teo_l7_acc_rule_extension.go

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
77
teo "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo/v20220901"
88
teov20220901 "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo/v20220901"
9+
tccommon "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/common"
910
"github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/internal/helper"
1011
)
1112

@@ -837,14 +838,16 @@ func TencentTeoL7RuleBranchBasicInfo(depth int) map[string]*schema.Schema {
837838
Description: "Origin-Pull protocol configuration. this parameter is required when origintype is ipdomain, origingroup, or loadbalance. valid values are: Http: use http protocol; Https: use https protocol; Follow: follow the protocol.",
838839
},
839840
"http_origin_port": {
840-
Type: schema.TypeInt,
841-
Optional: true,
842-
Description: "Ports for http origin-pull requests. value range: 1-65535. this parameter takes effect only when the origin-pull protocol originprotocol is http or follow.",
841+
Type: schema.TypeInt,
842+
Optional: true,
843+
ValidateFunc: tccommon.ValidateIntegerInRange(1, 65535),
844+
Description: "Ports for http origin-pull requests. value range: 1-65535. this parameter takes effect only when the origin-pull protocol originprotocol is http or follow.",
843845
},
844846
"https_origin_port": {
845-
Type: schema.TypeInt,
846-
Optional: true,
847-
Description: "Ports for https origin-pull requests. value range: 1-65535. this parameter takes effect only when the origin-pull protocol originprotocol is https or follow.",
847+
Type: schema.TypeInt,
848+
Optional: true,
849+
ValidateFunc: tccommon.ValidateIntegerInRange(1, 65535),
850+
Description: "Ports for https origin-pull requests. value range: 1-65535. this parameter takes effect only when the origin-pull protocol originprotocol is https or follow.",
848851
},
849852
"private_access": {
850853
Type: schema.TypeString,
@@ -1539,10 +1542,10 @@ func resourceTencentCloudTeoL7AccRuleGetBranchs(rulesMap map[string]interface{})
15391542
if v, ok := modifyOriginParametersMap["origin_protocol"].(string); ok && v != "" {
15401543
modifyOriginParameters.OriginProtocol = helper.String(v)
15411544
}
1542-
if v, ok := modifyOriginParametersMap["http_origin_port"].(int); ok {
1545+
if v, ok := modifyOriginParametersMap["http_origin_port"].(int); ok && v != 0 {
15431546
modifyOriginParameters.HTTPOriginPort = helper.IntInt64(v)
15441547
}
1545-
if v, ok := modifyOriginParametersMap["https_origin_port"].(int); ok {
1548+
if v, ok := modifyOriginParametersMap["https_origin_port"].(int); ok && v != 0 {
15461549
modifyOriginParameters.HTTPSOriginPort = helper.IntInt64(v)
15471550
}
15481551
if v, ok := modifyOriginParametersMap["private_access"].(string); ok && v != "" {

0 commit comments

Comments
 (0)