» cloudflare_zones

Use this data source to look up Zone records.

» Example Usage

The example below matches all active zones that begin with example. and are not paused. The matched zones are then locked down using the cloudflare_zone_lockdown resource.

data "cloudflare_zones" "test" {
  filter {
    name   = "example.*"
    status = "active"
    paused = false
  }
}

resource "cloudflare_zone_lockdown" "endpoint_lockdown" {
  count       = "${length(data.cloudflare_zones.test.zones)}"
  zone        = "${element(data.cloudflare_zones.test.zones, count.index)}"
  paused      = "false"
  description = "Restrict access to these endpoints to requests from a known IP address"
  urls = [
    "api.mysite.com/some/endpoint*",
  ]
  configurations = [
    {
      "target" = "ip"
      "value" = "198.51.100.4"
    },
  ]
}

» Argument Reference

  • filter - (Required) One or more values used to look up zone records. If more than one value is given all values must match in order to be included, see below for full list.

filter

  • name - (Optional) A regular expression matching the zone to lookup.
  • status - (Optional) Status of the zone to lookup. Valid values: active, pending, initializing, moved, deleted, deactivated and read only.
  • paused - (Optional) Paused status of the zone to lookup. Valid values are true or false.

» Attributes Reference

  • zones - A list of zone names