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

[cloudflare_ruleset] allow overriding ruleset sensitivity #1853

Closed
peterbppb opened this issue Aug 24, 2022 · 1 comment · Fixed by #1965
Closed

[cloudflare_ruleset] allow overriding ruleset sensitivity #1853

peterbppb opened this issue Aug 24, 2022 · 1 comment · Fixed by #1965
Labels
kind/enhancement Categorizes issue or PR as related to improving an existing feature. service/rulesets Categorizes issue or PR as related to the Rulesets service. workflow/pending-upstream-library Indicates an issue or PR requires changes from an upstream library.
Milestone

Comments

@peterbppb
Copy link

peterbppb commented Aug 24, 2022

Current Terraform and Cloudflare provider version

3.20.0

Description

Currently setting Ruleset sensitivity is not supported at the ruleset level.
Only setting individual rules sensitivity is supported.
I would like to be able to override ruleset sensitivity, same as ruleset Action:
image

Use cases

Having the ability to set sensitivity_level for the whole ruleset, making sure new rules added to the ddos_l7 ruleset will inherit this sensitivity level.

Potential Terraform configuration

terraform {
  required_providers {
    cloudflare = {
      source  = "cloudflare/cloudflare"
      version = "~> 3.0"
    }
  }

  required_version = ">= 1.0"
}

variable "zone_id" {
  type        = string
  description = "Cloudflare Zone ID"
}

variable "ruleset_id" {
  type        = string
  description = "Cloudflare Zone Ruleset ID"
}
/*
"{rule_id}" = {
  description       = ""
  sensitivity_level = "medium"
  action            = "log"
}
*/
variable "rules" {
  type = map(object({
    description       = string
    sensitivity_level = string
    action            = string
  }))
  description = "List of L7 DDOS rules to override"

}

resource "cloudflare_ruleset" "zone_level_ddos_config" {
  zone_id     = var.zone_id
  name        = "HTTP DDoS Attack Protection entry point ruleset"
  description = ""
  kind        = "zone"
  phase       = "ddos_l7"

  rules {
    action = "execute"
    action_parameters {
      id = var.ruleset_id
      overrides {
        action            = "log"
        sensitivity_level = "eoff"
        dynamic "rules" {
          for_each = var.rules
          content {
            id                = rules.key
            sensitivity_level = rules.value.sensitivity_level
            action            = rules.value.action
            description       = rules.value.description
          }
        }
      }
    }
    expression  = "true"
    description = "Override the HTTP DDoS Attack Protection Managed Ruleset"
    enabled     = true
  }
}

References

No response

@peterbppb peterbppb added kind/enhancement Categorizes issue or PR as related to improving an existing feature. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Aug 24, 2022
@jacobbednarz jacobbednarz added service/rulesets Categorizes issue or PR as related to the Rulesets service. workflow/pending-upstream-library Indicates an issue or PR requires changes from an upstream library. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Aug 24, 2022
jacobbednarz added a commit that referenced this issue Oct 13, 2022
@github-actions github-actions bot added this to the v3.26.0 milestone Oct 17, 2022
@github-actions
Copy link
Contributor

This functionality has been released in v3.26.0 of the Terraform Cloudflare 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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement Categorizes issue or PR as related to improving an existing feature. service/rulesets Categorizes issue or PR as related to the Rulesets service. workflow/pending-upstream-library Indicates an issue or PR requires changes from an upstream library.
Projects
None yet
2 participants