Provides individual list items (IPs, Redirects, ASNs, Hostnames) to be used in Edge Rules Engine across all zones within the same account.
# IP List
resource "cloudflare_list" "example_ip_list" {
account_id = "f037e56e89293a057740de681ac9abbe"
name = "example_list"
description = "example IPs for a list"
kind = "ip"
}
# IP List Item
resource "cloudflare_list_item" "example_ip_item" {
account_id = "f037e56e89293a057740de681ac9abbe"
list_id = cloudflare_list.example_ip_list.id
comment = "List Item Comment"
ip = "192.0.2.0"
}
# Redirect List
resource "cloudflare_list" "example_redirect_list" {
account_id = "f037e56e89293a057740de681ac9abbe"
name = "example_list"
description = "example Redirects for a list"
kind = "redirect"
}
# Redirect List Item
resource "cloudflare_list_item" "example_redirect_item" {
account_id = "f037e56e89293a057740de681ac9abbe"
list_id = cloudflare_list.example_ip_list.id
redirect {
source_url = "https://source.tld/"
target_url = "https://target.tld"
status_code = 302
subpath_matching = true
}
}
# ASN List
resource "cloudflare_list" "example_asn_list" {
account_id = "f037e56e89293a057740de681ac9abbe"
name = "example_asn_list"
description = "example ASNs for a list"
kind = "asn"
}
# ASN List Item
resource "cloudflare_list_item" "example_asn_item" {
account_id = "f037e56e89293a057740de681ac9abbe"
list_id = cloudflare_list.example_asn_list.id
comment = "List Item Comment"
asn = 6789
}
# Hostname List
resource "cloudflare_list" "example_hostname_list" {
account_id = "f037e56e89293a057740de681ac9abbe"
name = "example_hostname_list"
description = "example Hostnames for a list"
kind = "hostname"
}
# Hostname List Item
resource "cloudflare_list_item" "example_hostname_item" {
account_id = "f037e56e89293a057740de681ac9abbe"
list_id = cloudflare_list.example_hostname_list.id
comment = "List Item Comment"
hostname {
url_hostname = "example.com"
}
}
account_id
(String) The account identifier to target for the resource.list_id
(String) The list identifier to target for the resource.asn
(Number) Autonomous system number to include in the list. Must provide only one of: ip
, asn
, redirect
, hostname
.comment
(String) An optional comment for the item.hostname
(Block List) Hostname to store in the list. Must provide only one of: ip
, asn
, redirect
, hostname
. (see below for nested schema)ip
(String) IP address to include in the list. Must provide only one of: ip
, asn
, redirect
, hostname
.redirect
(Block List) Redirect configuration to store in the list. Must provide only one of: ip
, asn
, redirect
, hostname
. (see below for nested schema)id
(String) The list item identifier.hostname
Required:
url_hostname
(String) The FQDN to match on.redirect
Required:
source_url
(String) The source url of the redirect.target_url
(String) The target url of the redirect.Optional:
include_subdomains
(Boolean) Whether the redirect also matches subdomains of the source url.preserve_path_suffix
(Boolean) Whether the redirect target url should keep the query string of the request's url.preserve_query_string
(Boolean) Whether the redirect target url should keep the query string of the request's url.status_code
(Number) The status code to be used when redirecting a request.subpath_matching
(Boolean) Whether the redirect also matches subpaths of the source url.Import is supported using the following syntax:
$ terraform import cloudflare_list_item.example <account_id>/<list_id>/<item_id>