Skip to content

Commit 34526f5

Browse files
feat(waf): add data source to get available features under a region (#6877)
1 parent e7acfcf commit 34526f5

File tree

4 files changed

+447
-0
lines changed

4 files changed

+447
-0
lines changed

docs/data-sources/waf_config.md

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
---
2+
subcategory: "Web Application Firewall (WAF)"
3+
layout: "huaweicloud"
4+
page_title: "HuaweiCloud: huaweicloud_waf_config"
5+
description: |-
6+
Use this data source to get the available features under a region.
7+
---
8+
9+
# huaweicloud_waf_config
10+
11+
Use this data source to get the available features under a region.
12+
13+
## Example Usage
14+
15+
```hcl
16+
data "huaweicloud_waf_config" "test" {}
17+
```
18+
19+
## Argument Reference
20+
21+
The following arguments are supported:
22+
23+
* `region` - (Optional, String) Specifies the region in which to query the resource.
24+
If omitted, the provider-level region will be used.
25+
26+
## Attribute Reference
27+
28+
In addition to all arguments above, the following attributes are exported:
29+
30+
* `id` - The data source ID.
31+
32+
* `eps` - Whether EPS is supported.
33+
The value can be **true** or **false**.
34+
+ **true**: EPS is supported.
35+
+ **false**: EPS is not supported.
36+
37+
* `tls` - Whether to support the TLS version.
38+
The value can be **true** or **false**.
39+
+ **true**: TLS version is supported.
40+
+ **false**: TLS version is not supported.
41+
42+
* `ipv6` - Whether IPv6 protection is supported.
43+
The value can be **true** or **false**.
44+
+ **true**: IPv6 protection is supported.
45+
+ **false**: IPv6 protection is not supported.
46+
47+
* `alert` - Whether alarm reporting is supported.
48+
The value can be **true** or **false**.
49+
+ **true**: Alarm reporting is supported.
50+
+ **false**: Alarm reporting is not supported.
51+
52+
* `custom` - Whether precise protection is supported.
53+
The value can be **true** or **false**.
54+
+ **true**: Precise protection is supported.
55+
+ **false**: Precise protection is not supported.
56+
57+
* `elb_mode` - Whether ELB mode is supported.
58+
The value can be **true** or **false**.
59+
+ **true**: The ELB mode is supported.
60+
+ **false**: The ELB mode is not supported.
61+
62+
* `event_lts` - Whether LTS logging is supported.
63+
The value can be **true** or **false**.
64+
+ **true**: LTS logging is supported.
65+
+ **false**: LTS logging is not supported.
66+
67+
* `multi_dns` - Whether multi-DNS resolution is supported.
68+
The value can be **true** or **false**.
69+
+ **true**: The multi-DNS resolution is supported.
70+
+ **false**: The multi-DNS resolution is not supported.
71+
72+
* `search_ip` - Whether IP address search is supported.
73+
The value can be **true** or **false**.
74+
+ **true**: IP address search is supported.
75+
+ **false**: IP address search is not supported.
76+
77+
* `cc_enhance` - Whether CC attack protection is supported.
78+
The value can be **true** or **false**.
79+
+ **true**: CC attack protection is supported.
80+
+ **false**: CC attack protection is not supported.
81+
82+
* `cname_switch` - Whether CNAME switchover is supported.
83+
The value can be **true** or **false**.
84+
+ **true**: CNAME switchover is supported.
85+
+ **false**: CNAME switchover is not supported.
86+
87+
* `custom_block` - Whether custom block page is supported.
88+
The value can be **true** or **false**.
89+
+ **true**: The custom block page is supported.
90+
+ **false**: The custom block page is not supported.
91+
92+
* `advanced_ignore` - Whether false alarm masking is supported.
93+
The value can be **true** or **false**.
94+
+ **true**: The false alarm masking is supported.
95+
+ **false**: The false alarm masking is not supported.
96+
97+
* `js_crawler_enable` - Whether JS anti-crawler is supported.
98+
The value can be **true** or **false**.
99+
+ **true**: The JS anti-crawler is supported.
100+
+ **false**: The JS anti-crawler is not supported.
101+
102+
* `deep_decode_enable` - Whether deep inspection in basic web protection is supported.
103+
The value can be **true** or **false**.
104+
+ **true**: The deep inspection is supported.
105+
+ **false**: The deep inspection is not supported.
106+
107+
* `overview_bandwidth` - Whether security overview bandwidth statistics is supported.
108+
The value can be **true** or **false**.
109+
+ **true**: The security overview bandwidth statistics is supported.
110+
+ **false**: The security overview bandwidth statistics is not supported.
111+
112+
* `proxy_use_oldcname` - Whether old cname resolution is supported.
113+
The value can be **true** or **false**.
114+
+ **true**: The old cname resolution is supported.
115+
+ **false**: The old cname resolution is not supported.
116+
117+
* `check_all_headers_enable` - Whether all header inspection is supported.
118+
The value can be **true** or **false**.
119+
+ **true**: The all eader inspection is supported.
120+
+ **false**: The all header inspection is not supported.
121+
122+
* `geoip_enable` - Whether to support geolocation access control.
123+
The value can be **true** or **false**.
124+
+ **true**: The geolocation access control is supported.
125+
+ **false**: The geolocation access control is not supported.
126+
127+
* `load_balance_enable` - Whether to support domain name access load balancing.
128+
The value can be **true** or **false**.
129+
+ **true**: The domain name access load balancing is supported.
130+
+ **false**: The domain name access load balancing is not supported.
131+
132+
* `ipv6_protection_enable` - Whether IPv6 protection is supported.
133+
The value can be **true** or **false**.
134+
+ **true**: The IPv6 protection is supported.
135+
+ **false**: The IPv6 protection is not supported.
136+
137+
* `policy_sharing_enable` - Whether to support policy sharing.
138+
The value can be **true** or **false**.
139+
+ **true**: The policy sharing is supported.
140+
+ **false**: The policy sharing is not supported.
141+
142+
* `ip_group` - Whether the IP address group is supported.
143+
The value can be **true** or **false**.
144+
+ **true**: The IP address group is supported.
145+
+ **false**: The IP address group is not supported.
146+
147+
* `robot_action_enable` - Whether to support website anti-crawler.
148+
The value can be **true** or **false**.
149+
+ **true**: The website anti-crawler is supported.
150+
+ **false**: The website anti-crawler is not supported.
151+
152+
* `http2_enable` - Whether to support HTTP2.
153+
The value can be **true** or **false**.
154+
+ **true**: The HTTP2 is supported.
155+
+ **false**: The HTTP2 is not supported.
156+
157+
* `timeout_config_enable` - Whether to support the timeout configuration.
158+
The value can be **true** or **false**.
159+
+ **true**: The timeout configuration is supported.
160+
+ **false**: The timeout configuration is not supported.

huaweicloud/provider.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1397,6 +1397,7 @@ func Provider() *schema.Provider {
13971397
"huaweicloud_waf_address_groups": waf.DataSourceWafAddressGroups(),
13981398
"huaweicloud_waf_alarm_notifications": waf.DataSourceWafAlarmNotifications(),
13991399
"huaweicloud_waf_certificate": waf.DataSourceWafCertificate(),
1400+
"huaweicloud_waf_config": waf.DataSourceWafConfig(),
14001401
"huaweicloud_waf_dedicated_domains": waf.DataSourceWafDedicatedDomains(),
14011402
"huaweicloud_waf_dedicated_instances": waf.DataSourceWafDedicatedInstances(),
14021403
"huaweicloud_waf_domains": waf.DataSourceWafDomains(),
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package waf
2+
3+
import (
4+
"testing"
5+
6+
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
7+
8+
"github.com/huaweicloud/terraform-provider-huaweicloud/huaweicloud/services/acceptance"
9+
)
10+
11+
func TestAccDataSourceWafConfig_basic(t *testing.T) {
12+
var (
13+
datasource = "data.huaweicloud_waf_config.test"
14+
dc = acceptance.InitDataSourceCheck(datasource)
15+
)
16+
17+
resource.ParallelTest(t, resource.TestCase{
18+
PreCheck: func() {
19+
acceptance.TestAccPreCheck(t)
20+
},
21+
ProviderFactories: acceptance.TestAccProviderFactories,
22+
Steps: []resource.TestStep{
23+
{
24+
Config: testDataSourceWafConfig_basic,
25+
Check: resource.ComposeTestCheckFunc(
26+
dc.CheckResourceExists(),
27+
resource.TestCheckResourceAttrSet(datasource, "eps"),
28+
resource.TestCheckResourceAttrSet(datasource, "tls"),
29+
resource.TestCheckResourceAttrSet(datasource, "ipv6"),
30+
resource.TestCheckResourceAttrSet(datasource, "alert"),
31+
resource.TestCheckResourceAttrSet(datasource, "cc_enhance"),
32+
resource.TestCheckResourceAttrSet(datasource, "geoip_enable"),
33+
resource.TestCheckResourceAttrSet(datasource, "ip_group"),
34+
resource.TestCheckResourceAttrSet(datasource, "custom"),
35+
resource.TestCheckResourceAttrSet(datasource, "js_crawler_enable"),
36+
resource.TestCheckResourceAttrSet(datasource, "robot_action_enable"),
37+
),
38+
},
39+
},
40+
})
41+
}
42+
43+
const testDataSourceWafConfig_basic = `data "huaweicloud_waf_config" "test" {}`

0 commit comments

Comments
 (0)