Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[azurerm_web_application_firewall_policy] Fix max_request_body_size_in_kb, file_upload_limit_in_mb for CRS 3.2 #12817

Closed
obolobova opened this issue Aug 2, 2021 · 5 comments · Fixed by #14715

Comments

@obolobova
Copy link

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform (and AzureRM Provider) Version

Terraform v0.13.7

  • provider registry.terraform.io/hashicorp/azurerm v2.70.0

Affected Resource(s)

  • azurerm_web_application_firewall_policy

Expected Behaviour

https://docs.microsoft.com/en-us/azure/web-application-firewall/ag/application-gateway-waf-configuration#waf-request-size-limits

For CRS 3.2 (on the WAF_v2 SKU) and newer, these limits are as follows:

  • 2MB request body size limit
  • 4GB file upload limit

Actual Behaviour

Looks like Terraform still sticks to the old limits.
https://github.com/terraform-providers/terraform-provider-azurerm/blob/v2.70.0/azurerm/internal/services/network/web_application_firewall_policy_resource.go#L268

"file_upload_limit_in_mb": {
	Type:         pluginsdk.TypeInt,
	Optional:     true,
	ValidateFunc: validation.IntBetween(1, 750),
	Default:      100,
},
"max_request_body_size_in_kb": {
	Type:         pluginsdk.TypeInt,
	Optional:     true,
	ValidateFunc: validation.IntBetween(8, 128),
	Default:      128,
},

Error returned when trying to exceed the old limit, regardless of CRS 3.2 has been set.

Error: expected policy_settings.0.max_request_body_size_in_kb to be in the range (8 - 128), got 248

  on .terraform\modules\waf_policy\waf-policy-module\waf_policy.tf line 62, in resource "azurerm_web_application_firewall_policy" "this":
  62:     max_request_body_size_in_kb = var.policy_settings.max_request_body_size_in_kb
@favoretti
Copy link
Contributor

@tombuildsstuff Shall we just raise the limits and let people figure out version dependency or turn validation into a version-specific function?

@rafabu
Copy link

rafabu commented Nov 3, 2021

bumped into the same issue - meanwhile on provider azurerm v2.83.0.
Unfortunate as the possibility to increase the sizes were one of the main reasons that made us move to WAF policies from azurerm_application_gateway: waf_configuration and to OWASP Rule Set 3.2.

@varnav
Copy link
Contributor

varnav commented Dec 23, 2021

max_request_body_size_in_kb is fixed while file_upload_limit_in_mb is not.

#14369

lonegunmanb added a commit to lonegunmanb/terraform-provider-azurerm that referenced this issue Dec 23, 2021
@tombuildsstuff tombuildsstuff added this to the v2.91.0 milestone Dec 23, 2021
tombuildsstuff added a commit that referenced this issue Dec 23, 2021
`r\azurerm_azurerm_web_application_firewall_policy` fix #12817 by loose `file_upload_limit_in_mb` to 4000.
@github-actions
Copy link

github-actions bot commented Jan 7, 2022

This functionality has been released in v2.91.0 of the Terraform Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

github-actions bot commented Feb 7, 2022

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.