Skip to content

Commit

Permalink
Shorten "rule_set_*" properties and list some possible values in docs
Browse files Browse the repository at this point in the history
Signed-off-by: Sune Keller <absukl@almbrand.dk>
  • Loading branch information
sirlatrom committed Mar 21, 2020
1 parent b4446b6 commit e4731ee
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
Expand Up @@ -187,12 +187,12 @@ func resourceArmWebApplicationFirewallPolicy() *schema.Resource {
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"rule_set_type": {
"type": {
Type: schema.TypeString,
Required: true,
ValidateFunc: validation.NoZeroValues,
},
"rule_set_version": {
"version": {
Type: schema.TypeString,
Required: true,
ValidateFunc: validation.NoZeroValues,
Expand Down Expand Up @@ -427,11 +427,10 @@ func expandArmWebApplicationFirewallPolicyManagedRulesDefinition(input []interfa
exclusions := v["exclusion"].([]interface{})
managedRuleSets := v["managed_rule_set"].([]interface{})

result := network.ManagedRulesDefinition{
return &network.ManagedRulesDefinition{
Exclusions: expandArmWebApplicationFirewallPolicyExclusions(exclusions),
ManagedRuleSets: expandArmWebApplicationFirewallPolicyManagedRuleSet(managedRuleSets),
}
return &result
}

func expandArmWebApplicationFirewallPolicyExclusions(input []interface{}) *[]network.OwaspCrsExclusionEntry {
Expand Down Expand Up @@ -459,8 +458,8 @@ func expandArmWebApplicationFirewallPolicyManagedRuleSet(input []interface{}) *[
for _, item := range input {
v := item.(map[string]interface{})

ruleSetType := v["rule_set_type"].(string)
ruleSetVersion := v["rule_set_version"].(string)
ruleSetType := v["type"].(string)
ruleSetVersion := v["version"].(string)
ruleGroupOverrides := []interface{}{}
if value, exists := v["rule_group_overrides"]; exists {
ruleGroupOverrides = value.([]interface{})
Expand Down Expand Up @@ -632,8 +631,8 @@ func flattenArmWebApplicationFirewallPolicyManagedRuleSets(input *[]network.Mana
for _, item := range *input {
v := make(map[string]interface{})

v["rule_set_type"] = item.RuleSetType
v["rule_set_version"] = item.RuleSetVersion
v["type"] = item.RuleSetType
v["version"] = item.RuleSetVersion
v["rule_group_override"] = flattenArmWebApplicationFirewallPolicyRuleGroupOverrides(item.RuleGroupOverrides)

results = append(results, v)
Expand Down
8 changes: 4 additions & 4 deletions website/docs/r/web_application_firewall_policy.html.markdown
Expand Up @@ -175,19 +175,19 @@ The `managed_rules` block supports the following:

The `exclusion` block supports the following:

* `match_variable` - (Required) The name of the Match Variable.
* `match_variable` - (Required) The name of the Match Variable. Possible values: `RequestArgNames`, `RequestCookieNames`, `RequestHeaderNames`.

* `selector` - (Optional) Describes field of the matchVariable collection.

* `selector_match_operator` - (Required) Describes operator to be matched.
* `selector_match_operator` - (Required) Describes operator to be matched. Possible values: `Contains`, `EndsWith`, `Equals`, `EqualsAny`, `StartsWith`.

---

The `managed_rules_set` block supports the following:

* `rule_set_type` - (Required) The rule set type.
* `type` - (Required) The rule set type.

* `rule_set_version` - (Required) The rule set version.
* `version` - (Required) The rule set version.

* `rule_group_override` - (Optional) One or more `rule_group_override` block defined below.

Expand Down

0 comments on commit e4731ee

Please sign in to comment.