From ca950dbcbde0093f1137d518701ada834c625513 Mon Sep 17 00:00:00 2001 From: Sune Keller Date: Sat, 21 Mar 2020 15:31:22 +0100 Subject: [PATCH] Revert plurality normalization Signed-off-by: Sune Keller --- ...rce_arm_web_application_firewall_policy.go | 22 ++++++------ ..._application_firewall_policy.html.markdown | 36 +++++++++---------- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/azurerm/internal/services/network/resource_arm_web_application_firewall_policy.go b/azurerm/internal/services/network/resource_arm_web_application_firewall_policy.go index b8edabe6b9037..7060af38da2ee 100644 --- a/azurerm/internal/services/network/resource_arm_web_application_firewall_policy.go +++ b/azurerm/internal/services/network/resource_arm_web_application_firewall_policy.go @@ -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{ @@ -62,7 +62,7 @@ func resourceArmWebApplicationFirewallPolicy() *schema.Resource { string(network.WebApplicationFirewallActionLog), }, false), }, - "match_condition": { + "match_conditions": { Type: schema.TypeList, Required: true, Elem: &schema.Resource{ @@ -74,7 +74,7 @@ func resourceArmWebApplicationFirewallPolicy() *schema.Resource { Type: schema.TypeString, }, }, - "match_variable": { + "match_variables": { Type: schema.TypeList, Required: true, Elem: &schema.Resource{ @@ -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{}) @@ -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) } } @@ -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{ @@ -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{}) @@ -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) } @@ -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 } diff --git a/website/docs/r/web_application_firewall_policy.html.markdown b/website/docs/r/web_application_firewall_policy.html.markdown index d103506b46e48..4020a1dcbae0f 100644 --- a/website/docs/r/web_application_firewall_policy.html.markdown +++ b/website/docs/r/web_application_firewall_policy.html.markdown @@ -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" } @@ -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" } @@ -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" } @@ -70,7 +70,7 @@ resource "azurerm_web_application_firewall_policy" "example" { action = "Block" } - policy_setting { + policy_settings { enabled = true mode = "Prevention" } @@ -113,9 +113,9 @@ 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. @@ -123,7 +123,7 @@ The following arguments are supported: --- -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. @@ -131,15 +131,15 @@ The `custom_rule` block supports the following: * `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. @@ -149,7 +149,7 @@ 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 @@ -157,7 +157,7 @@ The `match_variable` block supports the following: --- -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`. @@ -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.