Skip to content

Commit

Permalink
Revert plurality normalization
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 9fa3f6e commit 7aeb41b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 29 deletions.
Expand Up @@ -48,7 +48,7 @@ func resourceArmWebApplicationFirewallPolicy() *schema.Resource {

"resource_group_name": azure.SchemaResourceGroupNameDiffSuppress(),

"custom_rule": {
"custom_rules": {
Type: schema.TypeList,
Optional: true,
Elem: &schema.Resource{
Expand All @@ -62,7 +62,7 @@ func resourceArmWebApplicationFirewallPolicy() *schema.Resource {
string(network.WebApplicationFirewallActionLog),
}, false),
},
"match_condition": {
"match_conditions": {
Type: schema.TypeList,
Required: true,
Elem: &schema.Resource{
Expand All @@ -74,7 +74,7 @@ func resourceArmWebApplicationFirewallPolicy() *schema.Resource {
Type: schema.TypeString,
},
},
"match_variable": {
"match_variables": {
Type: schema.TypeList,
Required: true,
Elem: &schema.Resource{
Expand Down Expand Up @@ -274,7 +274,7 @@ func resourceArmWebApplicationFirewallPolicyCreateUpdate(d *schema.ResourceData,
}

location := azure.NormalizeLocation(d.Get("location").(string))
customRules := d.Get("custom_rule").([]interface{})
customRules := d.Get("custom_rules").([]interface{})
policySettings := d.Get("policy_settings").([]interface{})
managedRules := d.Get("managed_rules").([]interface{})
t := d.Get("tags").(map[string]interface{})
Expand Down Expand Up @@ -333,14 +333,14 @@ func resourceArmWebApplicationFirewallPolicyRead(d *schema.ResourceData, meta in
d.Set("location", azure.NormalizeLocation(*location))
}
if webApplicationFirewallPolicyPropertiesFormat := resp.WebApplicationFirewallPolicyPropertiesFormat; webApplicationFirewallPolicyPropertiesFormat != nil {
if err := d.Set("custom_rule", flattenArmWebApplicationFirewallPolicyWebApplicationFirewallCustomRule(webApplicationFirewallPolicyPropertiesFormat.CustomRules)); err != nil {
if err := d.Set("custom_rules", flattenArmWebApplicationFirewallPolicyWebApplicationFirewallCustomRule(webApplicationFirewallPolicyPropertiesFormat.CustomRules)); err != nil {
return fmt.Errorf("Error setting `custom_rules`: %+v", err)
}
if err := d.Set("policy_settings", flattenArmWebApplicationFirewallPolicyPolicySettings(webApplicationFirewallPolicyPropertiesFormat.PolicySettings)); err != nil {
return fmt.Errorf("Error setting `policy_setting`: %+v", err)
return fmt.Errorf("Error setting `policy_settings`: %+v", err)
}
if err := d.Set("managed_rules", flattenArmWebApplicationFirewallPolicyManagedRulesDefinition(webApplicationFirewallPolicyPropertiesFormat.ManagedRules)); err != nil {
return fmt.Errorf("Error setting `managed_rule`: %+v", err)
return fmt.Errorf("Error setting `managed_rules`: %+v", err)
}
}

Expand Down Expand Up @@ -383,7 +383,7 @@ func expandArmWebApplicationFirewallPolicyWebApplicationFirewallCustomRule(input
name := v["name"].(string)
priority := v["priority"].(int)
ruleType := v["rule_type"].(string)
matchConditions := v["match_condition"].([]interface{})
matchConditions := v["match_conditions"].([]interface{})
action := v["action"].(string)

result := network.WebApplicationFirewallCustomRule{
Expand Down Expand Up @@ -512,7 +512,7 @@ func expandArmWebApplicationFirewallPolicyMatchCondition(input []interface{}) *[
results := make([]network.MatchCondition, 0)
for _, item := range input {
v := item.(map[string]interface{})
matchVariables := v["match_variable"].([]interface{})
matchVariables := v["match_variables"].([]interface{})
operator := v["operator"].(string)
negationCondition := v["negation_condition"].(bool)
matchValues := v["match_values"].([]interface{})
Expand Down Expand Up @@ -559,7 +559,7 @@ func flattenArmWebApplicationFirewallPolicyWebApplicationFirewallCustomRule(inpu
v["name"] = *name
}
v["action"] = string(item.Action)
v["match_condition"] = flattenArmWebApplicationFirewallPolicyMatchCondition(item.MatchConditions)
v["match_conditions"] = flattenArmWebApplicationFirewallPolicyMatchCondition(item.MatchConditions)
if priority := item.Priority; priority != nil {
v["priority"] = int(*priority)
}
Expand Down Expand Up @@ -684,7 +684,7 @@ func flattenArmWebApplicationFirewallPolicyMatchCondition(input *[]network.Match
v := make(map[string]interface{})

v["match_values"] = utils.FlattenStringSlice(item.MatchValues)
v["match_variable"] = flattenArmWebApplicationFirewallPolicyMatchVariable(item.MatchVariables)
v["match_variables"] = flattenArmWebApplicationFirewallPolicyMatchVariable(item.MatchVariables)
if negationCondition := item.NegationConditon; negationCondition != nil {
v["negation_condition"] = *negationCondition
}
Expand Down
36 changes: 18 additions & 18 deletions website/docs/r/web_application_firewall_policy.html.markdown
Expand Up @@ -23,13 +23,13 @@ resource "azurerm_web_application_firewall_policy" "example" {
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
custom_rule {
custom_rules {
name = "Rule1"
priority = 1
rule_type = "MatchRule"
match_condition {
match_variable {
match_conditions {
match_variables {
variable_name = "RemoteAddr"
}
Expand All @@ -41,13 +41,13 @@ resource "azurerm_web_application_firewall_policy" "example" {
action = "Block"
}
custom_rule {
custom_rules {
name = "Rule2"
priority = 2
rule_type = "MatchRule"
match_condition {
match_variable {
match_conditions {
match_variables {
variable_name = "RemoteAddr"
}
Expand All @@ -56,8 +56,8 @@ resource "azurerm_web_application_firewall_policy" "example" {
match_values = ["192.168.1.0/24"]
}
match_condition {
match_variable {
match_conditions {
match_variables {
variable_name = "RequestHeaders"
selector = "UserAgent"
}
Expand All @@ -70,7 +70,7 @@ resource "azurerm_web_application_firewall_policy" "example" {
action = "Block"
}
policy_setting {
policy_settings {
enabled = true
mode = "Prevention"
}
Expand Down Expand Up @@ -113,33 +113,33 @@ The following arguments are supported:

* `location` - (Optional) Resource location. Changing this forces a new resource to be created.

* `custom_rule` - (Optional) One or more `custom_rules` blocks as defined below.
* `custom_rules` - (Optional) One or more `custom_rules` blocks as defined below.

* `policy_setting` - (Optional) A `policy_setting` block as defined below.
* `policy_settings` - (Optional) A `policy_settings` block as defined below.

* `managed_rules` - (Optional) A `managed_rules` blocks as defined below.

* `tags` - (Optional) A mapping of tags to assign to the Web Application Firewall Policy.

---

The `custom_rule` block supports the following:
The `custom_rules` block supports the following:

* `name` - (Optional) Gets name of the resource that is unique within a policy. This name can be used to access the resource.

* `priority` - (Required) Describes priority of the rule. Rules with a lower value will be evaluated before rules with a higher value.

* `rule_type` - (Required) Describes the type of rule.

* `match_condition` - (Required) One or more `match_condition` blocks as defined below.
* `match_conditions` - (Required) One or more `match_conditions` blocks as defined below.

* `action` - (Required) Type of action.

---

The `match_condition` block supports the following:
The `match_conditions` block supports the following:

* `match_variable` - (Required) One or more `match_variable` blocks as defined below.
* `match_variables` - (Required) One or more `match_variables` blocks as defined below.

* `operator` - (Required) Describes operator to be matched.

Expand All @@ -149,15 +149,15 @@ The `match_condition` block supports the following:

---

The `match_variable` block supports the following:
The `match_variables` block supports the following:

* `variable_name` - (Required) The name of the Match Variable

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

---

The `policy_setting` block supports the following:
The `policy_settings` block supports the following:

* `enabled` - (Optional) Describes if the policy is in enabled state or disabled state Defaults to `Enabled`.

Expand All @@ -175,7 +175,7 @@ The `managed_rules` block supports the following:

The `exclusion` block supports the following:

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

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

Expand Down

0 comments on commit 7aeb41b

Please sign in to comment.