Skip to content

fix(teo): [123610226] tencentcloud_teo_l7_acc_rule update fileds #3325

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/3325.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/tencentcloud_teo_l7_acc_rule: update fileds
```
34 changes: 28 additions & 6 deletions tencentcloud/services/teo/resource_tc_teo_l7_acc_rule.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Provides a resource to create a teo l7_acc_rule
Provides a resource to create a TEO l7 acc rule

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

Example Usage

```hcl
resource "tencentcloud_teo_l7_acc_rule" "teo_l7_acc_rule" {
resource "tencentcloud_teo_l7_acc_rule" "example" {
zone_id = "zone-36bjhygh1bxe"
rules {
description = ["1"]
Expand All @@ -22,6 +22,7 @@ resource "tencentcloud_teo_l7_acc_rule" "teo_l7_acc_rule" {
}
}
}

actions {
name = "CacheKey"
cache_key_parameters {
Expand All @@ -35,6 +36,7 @@ resource "tencentcloud_teo_l7_acc_rule" "teo_l7_acc_rule" {
}
}
}

sub_rules {
description = ["1-1"]
branches {
Expand All @@ -49,6 +51,7 @@ resource "tencentcloud_teo_l7_acc_rule" "teo_l7_acc_rule" {
}
}
}

sub_rules {
description = ["1-2"]
branches {
Expand All @@ -64,6 +67,7 @@ resource "tencentcloud_teo_l7_acc_rule" "teo_l7_acc_rule" {
}
}
}

rules {
description = ["2"]
rule_name = "音视频直播"
Expand All @@ -84,6 +88,7 @@ resource "tencentcloud_teo_l7_acc_rule" "teo_l7_acc_rule" {
}
}
}

branches {
condition = "$${http.request.file_extension} in ['ts', 'mp4', 'm4a', 'm4s']"
actions {
Expand All @@ -97,6 +102,7 @@ resource "tencentcloud_teo_l7_acc_rule" "teo_l7_acc_rule" {
}
}
}

branches {
condition = "*"
actions {
Expand All @@ -114,6 +120,7 @@ resource "tencentcloud_teo_l7_acc_rule" "teo_l7_acc_rule" {
}
}
}

rules {
description = ["3"]
rule_name = "大文件下载"
Expand All @@ -129,6 +136,7 @@ resource "tencentcloud_teo_l7_acc_rule" "teo_l7_acc_rule" {
}
}
}

actions {
name = "CacheKey"
cache_key_parameters {
Expand All @@ -142,12 +150,14 @@ resource "tencentcloud_teo_l7_acc_rule" "teo_l7_acc_rule" {
}
}
}

actions {
name = "RangeOriginPull"
range_origin_pull_parameters {
switch = "on"
}
}

sub_rules {
description = ["3-1"]
branches {
Expand All @@ -164,6 +174,7 @@ resource "tencentcloud_teo_l7_acc_rule" "teo_l7_acc_rule" {
}
}
}

rules {
description = ["4"]
rule_name = "音视频点播"
Expand All @@ -179,6 +190,7 @@ resource "tencentcloud_teo_l7_acc_rule" "teo_l7_acc_rule" {
}
}
}

actions {
name = "CacheKey"
cache_key_parameters {
Expand All @@ -192,12 +204,14 @@ resource "tencentcloud_teo_l7_acc_rule" "teo_l7_acc_rule" {
}
}
}

actions {
name = "RangeOriginPull"
range_origin_pull_parameters {
switch = "on"
}
}

sub_rules {
description = ["4-1"]
branches {
Expand All @@ -214,6 +228,7 @@ resource "tencentcloud_teo_l7_acc_rule" "teo_l7_acc_rule" {
}
}
}

rules {
description = ["5"]
rule_name = "API 加速"
Expand All @@ -227,6 +242,7 @@ resource "tencentcloud_teo_l7_acc_rule" "teo_l7_acc_rule" {
}
}
}

actions {
name = "SmartRouting"
smart_routing_parameters {
Expand All @@ -235,6 +251,7 @@ resource "tencentcloud_teo_l7_acc_rule" "teo_l7_acc_rule" {
}
}
}

rules {
description = ["6"]
rule_name = "WordPress 建站"
Expand All @@ -255,6 +272,7 @@ resource "tencentcloud_teo_l7_acc_rule" "teo_l7_acc_rule" {
}
}
}

branches {
condition = "$${http.request.uri.path} in ['/']"
actions {
Expand All @@ -266,6 +284,7 @@ resource "tencentcloud_teo_l7_acc_rule" "teo_l7_acc_rule" {
}
}
}

branches {
condition = "$${http.request.file_extension} in ['aspx', 'jsp', 'php', 'asp', 'do', 'dwr', 'cgi', 'fcgi', 'action', 'ashx', 'axd']"
actions {
Expand All @@ -277,6 +296,7 @@ resource "tencentcloud_teo_l7_acc_rule" "teo_l7_acc_rule" {
}
}
}

branches {
condition = "$${http.request.uri.path} in ['/wp-admin/']"
actions {
Expand All @@ -288,6 +308,7 @@ resource "tencentcloud_teo_l7_acc_rule" "teo_l7_acc_rule" {
}
}
}

branches {
condition = "*"
actions {
Expand All @@ -306,11 +327,12 @@ resource "tencentcloud_teo_l7_acc_rule" "teo_l7_acc_rule" {
}
}
}

```

Import

teo l7_acc_rule can be imported using the zone_id, e.g.
TEO l7 acc rule can be imported using the zone_id, e.g.

````
terraform import tencentcloud_teo_l7_acc_rule.example zone-36bjhygh1bxe
````
terraform import tencentcloud_teo_l7_acc_rule.teo_l7_acc_rule zone-297z8rf93cfw
````
19 changes: 11 additions & 8 deletions tencentcloud/services/teo/resource_tc_teo_l7_acc_rule_extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
teo "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo/v20220901"
teov20220901 "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo/v20220901"
tccommon "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/common"
"github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/internal/helper"
)

Expand Down Expand Up @@ -837,14 +838,16 @@ func TencentTeoL7RuleBranchBasicInfo(depth int) map[string]*schema.Schema {
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.",
},
"http_origin_port": {
Type: schema.TypeInt,
Optional: true,
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.",
Type: schema.TypeInt,
Optional: true,
ValidateFunc: tccommon.ValidateIntegerInRange(1, 65535),
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.",
},
"https_origin_port": {
Type: schema.TypeInt,
Optional: true,
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.",
Type: schema.TypeInt,
Optional: true,
ValidateFunc: tccommon.ValidateIntegerInRange(1, 65535),
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.",
},
"private_access": {
Type: schema.TypeString,
Expand Down Expand Up @@ -1539,10 +1542,10 @@ func resourceTencentCloudTeoL7AccRuleGetBranchs(rulesMap map[string]interface{})
if v, ok := modifyOriginParametersMap["origin_protocol"].(string); ok && v != "" {
modifyOriginParameters.OriginProtocol = helper.String(v)
}
if v, ok := modifyOriginParametersMap["http_origin_port"].(int); ok {
if v, ok := modifyOriginParametersMap["http_origin_port"].(int); ok && v != 0 {
modifyOriginParameters.HTTPOriginPort = helper.IntInt64(v)
}
if v, ok := modifyOriginParametersMap["https_origin_port"].(int); ok {
if v, ok := modifyOriginParametersMap["https_origin_port"].(int); ok && v != 0 {
modifyOriginParameters.HTTPSOriginPort = helper.IntInt64(v)
}
if v, ok := modifyOriginParametersMap["private_access"].(string); ok && v != "" {
Expand Down
Loading
Loading