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

[Enhancement]: Add support for Custom keys and Count all rate-limiting criteria in WAF #31625

Closed
lkoniecz opened this issue May 29, 2023 · 10 comments · Fixed by #33594
Closed
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/wafv2 Issues and PRs that pertain to the wafv2 service.
Milestone

Comments

@lkoniecz
Copy link

Description

Rate limiting only supports 2 out of 4 possible aggregation criteria:
https://registry.terraform.io/providers/hashicorp/aws/4.67.0/docs/resources/wafv2_web_acl#aggregate_key_type

Affected Resource(s) and/or Data Source(s)

aws_wafv2_web_acl

Potential Terraform Configuration

No response

References

https://docs.aws.amazon.com/waf/latest/developerguide/waf-rule-statement-type-rate-based-aggregation-options.html

Would you like to implement a fix?

None

@lkoniecz lkoniecz added enhancement Requests to existing resources that expand the functionality or scope. needs-triage Waiting for first response or review from a maintainer. labels May 29, 2023
@github-actions
Copy link

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@justinretzolk justinretzolk added service/wafv2 Issues and PRs that pertain to the wafv2 service. and removed needs-triage Waiting for first response or review from a maintainer. labels Jun 1, 2023
paxal added a commit to sportmium/terraform-provider-aws that referenced this issue Jul 6, 2023
[RateBasedStatement](https://docs.aws.amazon.com/waf/latest/APIReference/API_RateBasedStatement.html) supports `IP`, `FORWARDED_IP` but also `CONSTANT` and
`CUSTOM_KEYS`.

`CONSTANT` is already supported because validation is made against aws
SDK where it is declared as valid value.

Relates to hashicorp#31625
@mldevpants
Copy link

We had a feature request with AWS for this, I stopped Nginx in favor of this feature, but I cannot do terraform for it.
The import works great BTW, but it cannot be applied since the provider does not recognize the CUSTOM_KEYS.

@cesarcelism
Copy link

We had a feature request with AWS for this, I stopped Nginx in favor of this feature, but I cannot do terraform for it. The import works great BTW, but it cannot be applied since the provider does not recognize the CUSTOM_KEYS.

Besides the aggregate_key_type, also it needs to be explicit which will be the aggregate key. The SDK provides RateBasedStatementCustomKey data type to achieve that.

@peter-hippo
Copy link

A workaround for now when creating a new resource is to do the WAF rule based upon "IP", terraform everything, then manually change to CUSTOM_KEYS + whatever settings, then updating the TF code to say "CUSTOM_KEYS" and there is no diff. It's not perfect but this way one can create the resource with TF and maintain the main lifecycle of it.

@matthewbae
Copy link

@peter-hippo how did you get around the errors when doing terraform plan? I see these errors:

Error: expected rule.1.statement.0.rate_based_statement.0.aggregate_key_type to be one of [IP FORWARDED_IP], got CUSTOM_KEYS

@sakaru
Copy link

sakaru commented Aug 5, 2023

@matthewbae Are you using the latest version of the aws provider? I had the same issue using 4.64.0. After a bump to 5.10.0 (then the latest version) it went away.

@matthewbae
Copy link

matthewbae commented Aug 5, 2023

Thanks @sakaru. I'm on 4.30.0, so I'll give a bump to the latest version!

@luqmanMohammed
Copy link
Contributor

Any ETA on the availability of this feature?

@github-actions
Copy link

This functionality has been released in v5.19.0 of the Terraform AWS 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

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 Oct 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/wafv2 Issues and PRs that pertain to the wafv2 service.
Projects
None yet
8 participants