Closed ghost closed 8 months ago
It seems like a service side's issue, I've opened a support ticket for it.
Hi @ghost , sorry for the late reply. The service team confirmed that the document is wrong:
List of rules that will be disabled. If none specified, all rules in the group will be disabled.
It should be:
List of rules that will be disabled. If none specified, all rules in the group will be enabled.
So the firewall works as expected.
I'll update Terraform's doc when Microsoft has updated their doc.
Thanks for taking the time to open this issue. As seen on the above linked microsoft and terraform registry documentation, both have been updated to say disabled, as such I am going to mark this issue as complete. https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/frontdoor_firewall_policy#override
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Community Note
Terraform (and AzureRM Provider) Version
Affected Resource(s)
azurerm_frontdoor_firewall_policy
Terraform Configuration Files
variables.tf
main.tf
Expected Behaviour
Expect that all PHP rules would be disabled. i.e.
[933100, 933110, 933120, 933130, 933140, 933150, 933151, 933160, 933170, 933180]
.Actual Behaviour
No PHP rules are disabled.
Steps to Reproduce
-var
,terraform.tfvars
etc.)rule
under theoverride
block:terraform apply
FrontDoorWAFv2
>Managed rules
to see that the single rule (933100
) has been disabledrule
blockterraform apply
Important Factoids
Debug output from the Terraform command shows the following (removed most of it as it's not relevant and has IDs etc. in it):
PUT /subscriptions/{subscription_id}/resourceGroups/{resource_group}/providers/Microsoft.Network/frontDoorWebApplicationFirewallPolicies/FrontDoorWAFv2?api-version=2020-04-01
This shows the payload being sent over with the rule group name (PHP) and no additional
rule
blocks, which should disable all rules for the rule group name.This has me wondering whether or not it's actually a bug in MS' API (2020-04-01). The only difference I can see is that the provider calls an earlier version of the API:
MS API Docs for 2020-11-01 show only 2 parameters for the managed rule group override, the rule group name and the rules (optional), which if omitted should disable all rules in the group. If there was a bug and it's been fixed, would it be possible to update the provider to use a newer version of the API/SDK?
References
Based on the override documentation for configuring policy on an Azure Front-door service, adding the
override
block:The docs state that if no
rule
blocks are supplied within theoverride
block, that:Interestingly, the Microsoft API docs say the same thing:
https://docs.microsoft.com/en-us/rest/api/frontdoorservice/webapplicationfirewall/policies/list#managedrulegroupoverride