alicloud_esa_http_request_header_modification_rule

更新时间:

Provides a ESA Http Request Header Modification Rule resource.

For information about ESA Http Request Header Modification Rule and how to use it, see What is Http Request Header Modification Rule.

-> NOTE: Available since v1.242.0.

Example Usage

Basic Usage


provider "alicloud" {
  region = "cn-hangzhou"
}

variable "name" {
  default = "terraform-example"
}

resource "alicloud_esa_rate_plan_instance" "instance" {
  type         = "NS"
  auto_renew   = "false"
  period       = "1"
  payment_type = "Subscription"
  coverage     = "overseas"
  auto_pay     = "true"
  plan_name    = "high"
}

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

resource "alicloud_esa_site" "site" {
  site_name   = "gositecdn-${random_integer.default.result}.cn"
  instance_id = alicloud_esa_rate_plan_instance.instance.id
  coverage    = "overseas"
  access_type = "NS"
}


resource "alicloud_esa_http_request_header_modification_rule" "default" {
  rule_name = "example_modify"
  request_header_modification {
    value     = "modify1"
    operation = "modify"
    name      = "example_modify1"
  }

  site_id      = alicloud_esa_site.site.id
  rule_enable  = "off"
  rule         = "(http.request.uri eq \"/content?page=1234\")"
  site_version = "0"
}

Argument Reference

The following arguments are supported:

  • request_header_modification - (Required, List) The configurations of modifying request headers. You can add, delete, or modify a request header. See request_header_modification below.
  • rule - (Optional) Rule content, using conditional expressions to match user requests. When adding global configuration, this parameter does not need to be set. There are two usage scenarios:
    • Match all incoming requests: value set to true
    • Match specified request: Set the value to a custom expression, for example: (http.host eq "video.example.com")
  • rule_enable - (Optional) Rule switch. When adding global configuration, this parameter does not need to be set. Value range:
    • on: open.
    • off: close.
  • rule_name - (Optional) Rule name. When adding global configuration, this parameter does not need to be set.
  • site_id - (Required, ForceNew, Int) The site ID.
  • site_version - (Optional, ForceNew, Int) The version number of the website configurations.

request_header_modification

The request_header_modification supports the following:

  • name - (Required) Request Header Name.
  • operation - (Required) Mode of operation. Value range:
    • add: add.
    • del: delete
    • modify: change.
  • value - (Optional) Request header value

Attributes Reference

The following attributes are exported:

  • id - The ID of the resource supplied above.The value is formulated as <site_id>:<config_id>.
  • config_id - Config Id

Timeouts

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

  • create - (Defaults to 5 mins) Used when create the Http Request Header Modification Rule.
  • delete - (Defaults to 5 mins) Used when delete the Http Request Header Modification Rule.
  • update - (Defaults to 5 mins) Used when update the Http Request Header Modification Rule.

Import

ESA Http Request Header Modification Rule can be imported using the id, e.g.

$ terraform import alicloud_esa_http_request_header_modification_rule.example <site_id>:<config_id>