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

Adding rate based rule to regional WAF #4174

Closed
mkohn opened this issue Apr 11, 2018 · 7 comments
Closed

Adding rate based rule to regional WAF #4174

mkohn opened this issue Apr 11, 2018 · 7 comments
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/waf Issues and PRs that pertain to the waf service.
Milestone

Comments

@mkohn
Copy link

mkohn commented Apr 11, 2018

Hi there,

Terraform Version

terraform -v
Terraform v0.11.7
+ provider.aws v1.14.0

Affected Resource(s)

  • aws_wafregional_web_acl
  • aws_wafregional_rate_based_rule

Terraform Configuration Files

resource "aws_wafregional_web_acl" "regional_acl" {
  name        = "${var.tag_application} ${var.environment} WAF ACL"
  metric_name = "${var.tag_application}${var.environment}WAFACL"

  default_action {
    type = "ALLOW"
  }
  rule = [
    {
      action {
        type = "${var.action_blacklist}"
      }

      priority = 1
      rule_id  = "${aws_wafregional_rate_based_rule.rate_limiting.id}"
   }
]
}

resource "aws_wafregional_ipset" "rate_limiting" {
  name = "Rate Limiting ${var.tag_application} ${var.environment}"
}

resource "aws_wafregional_rate_based_rule" "rate_limiting" {
  name        = "Rate Limiting ${var.tag_application} ${var.environment}"
  metric_name = "RateLimiting${var.tag_application}${var.environment}"

  rate_key   = "IP"
  rate_limit = "${var.waf_ratelimit}"

  predicate {
    data_id = "${aws_wafregional_ipset.rate_limiting.id}"
    negated = false
    type    = "IPMatch"
  }
}

Debug Output

~/scratch/temp  terraform init
Initializing modules...
- module.WAF
  Getting source "../../git/m-waf/"

Initializing provider plugins...
- Checking for available provider plugins on https://releases.hashicorp.com...
- Downloading plugin for provider "aws" (1.14.0)...
terr
Terraform has been successfully initialized!

You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.

If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.
 mkohn@eleanor  ~/scratch/temp  terraform -v
Terraform v0.11.7
+ provider.aws v1.14.0

* module.WAF.aws_wafregional_web_acl.regional_acl: 1 error(s) occurred:

* aws_wafregional_web_acl.regional_acl: Error Updating WAF Regional ACL: Error Updating WAF Regional ACL: WAFInvalidOperationException: Operation is invalid for this entity.
	status code: 400, request id: 27cfb65c-3d97-11e8-b5a6-d7d2dd5acce8

Expected Behavior

Attach WAF Regional Rate based rule to the WAF Regional ACL

Important Factoids

What I think is that terraform does not support rate base rules getting added to regional_acl for WAF. the global WAF has this parameter: https://www.terraform.io/docs/providers/aws/r/waf_web_acl.html#type-1 where when you look on this page, https://www.terraform.io/docs/providers/aws/r/wafregional_web_acl.html its missing that section.

Can someone help me validate my theory?

@thereverendtom
Copy link

You are correct - I ran into the same issue. Terraform does not support adding rate based rules to regional_acl at this time.

@mkohn
Copy link
Author

mkohn commented Apr 11, 2018

So basically if I'm understanding this, you can create the regional rate based rule but not add it to the ACL. Can I request an enhancement?

@thereverendtom
Copy link

Yep - that's what I'm seeing. I created this ticket related to my issue: #4079. It looks like waf_regional support was just added, as was support for rate based rules with regular waf. So, my guess is the two just haven't caught up and an enhancement is required.

@mkohn
Copy link
Author

mkohn commented Apr 12, 2018

Cool, my searches missed that item. Guess I will just wait. Thanks

omeid added a commit to omeid/terraform-provider-aws that referenced this issue Apr 22, 2018
This commit adds rule type support so that Rate Limit rules
could be use along with REGULAR rules.

Closes hashicorp#4079 hashicorp#4174 hashicorp#4052
@radeksimko radeksimko added enhancement Requests to existing resources that expand the functionality or scope. service/waf Issues and PRs that pertain to the waf service. labels Apr 24, 2018
@bflad bflad added this to the v1.25.0 milestone Jun 25, 2018
@bflad
Copy link
Contributor

bflad commented Jun 25, 2018

The aws_wafregional_web_acl resource support for rule type has been merged into master via #4978 and will release with version 1.25.0 of the AWS provider, likely middle of this week. Please note you must configure this new attribute for RATE_BASED rules.

@bflad bflad closed this as completed Jun 25, 2018
@bflad
Copy link
Contributor

bflad commented Jun 27, 2018

This has been released in version 1.25.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

@ghost
Copy link

ghost commented Apr 4, 2020

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Apr 4, 2020
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/waf Issues and PRs that pertain to the waf service.
Projects
None yet
Development

No branches or pull requests

4 participants