alicloud_dcdn_waf_rule

Provides a Dcdn Waf Rule resource.

For information about Dcdn Waf Rule and how to use it, see What is Waf Rule.

Example Usage

Basic Usage

variable "name" {
  default = "tf_example"
}

resource "random_integer" "default" {
  min = 10000
  max = 99999
}

resource "alicloud_dcdn_waf_policy" "example" {
  defense_scene = "waf_group"
  policy_name   = "${var.name}_${random_integer.default.result}"
  policy_type   = "custom"
  status        = "on"
}

resource "alicloud_dcdn_waf_rule" "example" {
  policy_id = alicloud_dcdn_waf_policy.example.id
  rule_name = var.name
  conditions {
    key      = "URI"
    op_value = "ne"
    values   = "/login.php"
  }
  conditions {
    key      = "Header"
    sub_key  = "a"
    op_value = "eq"
    values   = "b"
  }
  status = "on"
  action = "monitor"
  rate_limit {
    target    = "IP"
    interval  = "5"
    threshold = "5"
    ttl       = "1800"
    status {
      code  = "200"
      ratio = "60"
    }
  }
}

Argument Reference

The following arguments are supported:

conditions

The conditions supports the following:

rate_limit

The rate_limit supports the following:

rate_limit-status

The status supports the following:

Attributes Reference

The following attributes are exported:

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

Import

Dcdn Waf Rule can be imported using the id, e.g.

$ terraform import alicloud_dcdn_waf_rule.example <id>