Use this data source to look up Zone results for use in other resources.
# Given you have the following zones in Cloudflare.
#
# - example.com
# - example.net
# - not-example.com
#
# Look for a single zone that you know exists using an exact match.
# API request will be for zones?name=example.com. Will not match not-example.com
# or example.net.
data "cloudflare_zones" "example" {
filter {
name = "example.com"
}
}
# Look for all zones which include "example".
# API request will be for zones?name=contains:example. Will return all three
# zones.
data "cloudflare_zones" "example" {
filter {
name = "example"
lookup_type = "contains"
}
}
# Look for all zones which include "example" but start with "not-".
# API request will be for zones?name=contains:example. Will perform client side
# filtering using the provided regex and will only match the single zone,
# not-example.com.
data "cloudflare_zones" "example" {
filter {
name = "example"
lookup_type = "contains"
match = "^not-"
}
}
# Look for all active zones in an account.
data "cloudflare_zones" "example" {
filter {
account_id = "f037e56e89293a057740de681ac9abbe"
status = "active"
}
}
filter
(Block List, Min: 1, Max: 1) 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 nested schema)id
(String) The ID of this resource.zones
(List of Object) A list of zone objects. (see below for nested schema)filter
Optional:
account_id
(String) The account identifier to target for the resource.lookup_type
(String) The type of search to perform for the name
value when querying the zone API. Available values: contains
, exact
. Defaults to exact
.match
(String) A RE2 compatible regular expression to filter the results. This is performed client side whereas the name
and lookup_type
are performed on the Cloudflare server side.name
(String) A string value to search for.paused
(Boolean) Paused status of the zone to lookup. Defaults to false
.status
(String) Status of the zone to lookup.zones
Read-Only:
id
(String)name
(String)