Skip to content

Commit ff3fe91

Browse files
committed
add
1 parent 0f80143 commit ff3fe91

15 files changed

+1189
-98
lines changed

tencentcloud/services/waf/resource_tc_waf_anti_fake.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func ResourceTencentCloudWafAntiFake() *schema.Resource {
3535
"name": {
3636
Required: true,
3737
Type: schema.TypeString,
38-
Description: "Name.",
38+
Description: "Rule Name.",
3939
},
4040
"uri": {
4141
Required: true,
@@ -47,17 +47,17 @@ func ResourceTencentCloudWafAntiFake() *schema.Resource {
4747
Type: schema.TypeInt,
4848
Default: ANTI_FAKE_URL_STATUS_1,
4949
ValidateFunc: tccommon.ValidateAllowedIntValue(ANTI_FAKE_URL_STATUS),
50-
Description: "status. 0: Turn off rules and log switches, 1: Turn on the rule switch and Turn off the log switch; 2: Turn off the rule switch and turn on the log switch;3: Turn on the log switch.",
50+
Description: "Status. 0: Turn off rules and log switches, 1: Turn on the rule switch and Turn off the log switch; 2: Turn off the rule switch and turn on the log switch;3: Turn on the log switch.",
5151
},
5252
"rule_id": {
5353
Computed: true,
5454
Type: schema.TypeInt,
55-
Description: "rule id.",
55+
Description: "Rule ID.",
5656
},
5757
"protocol": {
5858
Computed: true,
5959
Type: schema.TypeString,
60-
Description: "protocol.",
60+
Description: "Protocol.",
6161
},
6262
},
6363
}

tencentcloud/services/waf/resource_tc_waf_anti_info_leak.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func ResourceTencentCloudWafAntiInfoLeak() *schema.Resource {
4040
Required: true,
4141
Type: schema.TypeInt,
4242
ValidateFunc: tccommon.ValidateAllowedIntValue(ANTI_INFO_LEAK_ACTION_TYPE),
43-
Description: "Rule Action. 0: alarm; 1: replacement; 2: only displaying the first four digits; 3: only displaying the last four digits; 4: blocking.",
43+
Description: "Rule Action, 0 (log), 1 (replace), 2 (only display the first four digits), 3 (only display the last four digits), 4 (deny).",
4444
},
4545
"strategies": {
4646
Required: true,
@@ -52,12 +52,17 @@ func ResourceTencentCloudWafAntiInfoLeak() *schema.Resource {
5252
Type: schema.TypeString,
5353
Required: true,
5454
ValidateFunc: tccommon.ValidateAllowedStringValue(STRATEGIES_FIELD),
55-
Description: "Matching Fields. support: returncode, keywords, information.",
55+
Description: "Matching Criteria, returncode (Response Code), keywords (Keywords), information (Sensitive Information).",
5656
},
5757
"content": {
58-
Type: schema.TypeString,
59-
Required: true,
60-
Description: "Matching Content. If field is returncode support: 400, 403, 404, 4xx, 500, 501, 502, 504, 5xx; If field is information support: idcard, phone, bankcard; If field is keywords users input matching content themselves.",
58+
Type: schema.TypeString,
59+
Required: true,
60+
Description: `Matching content
61+
The following options are available when Field is set to information:
62+
idcard (ID card), phone (phone number), and bankcard (bank card).
63+
The following options are available when Field is set to returncode:
64+
400 (status code 400), 403 (status code 403), 404 (status code 404), 4xx (other 4xx status codes), 500 (status code 500), 501 (status code 501), 502 (status code 502), 504 (status code 504), and 5xx (other 5xx status codes).
65+
When Field is set to keywords, users need to input the matching content themselves.`,
6166
},
6267
},
6368
},

tencentcloud/services/waf/resource_tc_waf_cc.go

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func ResourceTencentCloudWafCc() *schema.Resource {
4242
"advance": {
4343
Required: true,
4444
Type: schema.TypeString,
45-
Description: "Session match mode, 0 use ip, 1 use session.",
45+
Description: "Advanced mode (whether to use session detection). 0(disabled) 1(enabled).",
4646
},
4747
"limit": {
4848
Required: true,
@@ -52,17 +52,17 @@ func ResourceTencentCloudWafCc() *schema.Resource {
5252
"interval": {
5353
Required: true,
5454
Type: schema.TypeString,
55-
Description: "Interval.",
55+
Description: "CC detection cycle.",
5656
},
5757
"url": {
5858
Required: true,
5959
Type: schema.TypeString,
60-
Description: "Check URL.",
60+
Description: "Detection URL.",
6161
},
6262
"match_func": {
6363
Required: true,
6464
Type: schema.TypeInt,
65-
Description: "Match method, 0 equal, 1 prefix, 2 contains.",
65+
Description: "Match method, 0(equal), 1(prefix), 2(contains), 3(not equal), 6(suffix), 7(not contains).",
6666
},
6767
"action_type": {
6868
Required: true,
@@ -79,11 +79,19 @@ func ResourceTencentCloudWafCc() *schema.Resource {
7979
Type: schema.TypeInt,
8080
Description: "Action ValidTime, minute unit. Min: 60, Max: 604800.",
8181
},
82-
//"options_arr": {
83-
// Optional: true,
84-
// Type: schema.TypeString,
85-
// Description: "Option param.",
86-
//},
82+
"options_arr": {
83+
Optional: true,
84+
Type: schema.TypeString,
85+
Description: `JSON serialized string of CC matching conditions, example:[{\"key\":\"Method\",\"args\":[\"=R0VU\"],\"match\":\"0\",\"encodeflag\":true}]
86+
Key optional values are Method, Post, Referer, Cookie, User-Agent, CustomHeader
87+
Match optional values are, when Key is Method, optional values are 0 (equal), 3 (not equal).
88+
When the key is Post, the optional values are 0 (equal to), 3 (not equal to), when the key is Cookie, the optional values are 0 (equal to), 2 (included), 3 (not equal to), 7 (not included),
89+
When the key is Referer, the optional values are 0 (equal to), 3 (not equal to), 1 (prefix match), 6 (suffix match), 2 (included), 7 (not included), 12 (exists), 5 (not included), 4 (content is empty),
90+
When the key is Cookie, the optional values are 0 (equal to), 3 (not equal to), 2 (included), 7 (not included),
91+
When the key is User-Agent, the optional values are 0 (equal to), 3 (not equal to), 1 (prefix match), 6 (suffix match), 2 (included), 7 (not included), 12 (exists), 5 (not included), 4 (content is empty),
92+
When the key is CustomHeader, the optional values are 0 (equal to), 3 (not equal to), 2 (included), 7 (not included), 12 (exists), 5 (not included), 4 (content is empty).
93+
args is used to indicate the matching content. You need to set encodeflag to true. When the Key is Post, Cookie, or CustomHeader, use the equal sign = to concatenate the Key and Value, and encode them using Base64, similar to YWJj=YWJj. When the Key is Referer or User-Agent, use the equal sign = to concatenate the Value, similar to =YWJj.`,
94+
},
8795
"edition": {
8896
Required: true,
8997
Type: schema.TypeString,
@@ -104,7 +112,7 @@ func ResourceTencentCloudWafCc() *schema.Resource {
104112
Optional: true,
105113
Type: schema.TypeSet,
106114
Elem: &schema.Schema{Type: schema.TypeInt},
107-
Description: "Advance mode use session id.",
115+
Description: "Session ID that needs to be enabled for the rule.",
108116
},
109117
"rule_id": {
110118
Computed: true,
@@ -174,9 +182,9 @@ func resourceTencentCloudWafCcCreate(d *schema.ResourceData, meta interface{}) e
174182
request.ValidTime = helper.IntInt64(v.(int))
175183
}
176184

177-
//if v, ok := d.GetOk("options_arr"); ok {
178-
// request.OptionsArr = helper.String(v.(string))
179-
//}
185+
if v, ok := d.GetOk("options_arr"); ok {
186+
request.OptionsArr = helper.String(v.(string))
187+
}
180188

181189
if v, ok := d.GetOk("edition"); ok {
182190
request.Edition = helper.String(v.(string))
@@ -302,9 +310,9 @@ func resourceTencentCloudWafCcRead(d *schema.ResourceData, meta interface{}) err
302310
_ = d.Set("valid_time", cc.ValidTime)
303311
}
304312

305-
//if cc.Options != nil {
306-
// _ = d.Set("options_arr", cc.Options)
307-
//}
313+
if cc.Options != nil {
314+
_ = d.Set("options_arr", cc.Options)
315+
}
308316
//
309317
//if cc.Edition != nil {
310318
// _ = d.Set("edition", cc.Edition)
@@ -396,9 +404,9 @@ func resourceTencentCloudWafCcUpdate(d *schema.ResourceData, meta interface{}) e
396404
request.ValidTime = helper.IntInt64(v.(int))
397405
}
398406

399-
//if v, ok := d.GetOk("options_arr"); ok {
400-
// request.OptionsArr = helper.String(v.(string))
401-
//}
407+
if v, ok := d.GetOk("options_arr"); ok {
408+
request.OptionsArr = helper.String(v.(string))
409+
}
402410

403411
if v, ok := d.GetOk("edition"); ok {
404412
request.Edition = helper.String(v.(string))

tencentcloud/services/waf/resource_tc_waf_cc.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,15 @@ resource "tencentcloud_waf_cc" "example" {
1717
valid_time = 600
1818
edition = "sparta-waf"
1919
type = 1
20+
options_arr = jsonencode(
21+
[
22+
{
23+
"key" : "Method",
24+
"args" : ["=R0VU"],
25+
"match" : "0",
26+
"encodeflag" : true
27+
}
28+
]
29+
)
2030
}
2131
```

tencentcloud/services/waf/resource_tc_waf_cc_auto_status.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func ResourceTencentCloudWafCcAutoStatus() *schema.Resource {
4040
"status": {
4141
Computed: true,
4242
Type: schema.TypeInt,
43-
Description: "cc auto status, 1 means open, 0 means close.",
43+
Description: "cc auto status, 1(open), 0(close).",
4444
},
4545
},
4646
}

0 commit comments

Comments
 (0)