Skip to content
Start here

Rules Lists

Rules ListsLists

resource cloudflare_list

required Expand Collapse
account_id: String

The Account ID for this resource.

kind: String

The type of the list. Each type supports specific list items (IP addresses, ASNs, hostnames or redirects).

name: String

An informative name for the list. Use this name in filter and rule expressions.

optional Expand Collapse
description?: String

An informative summary of the list.

computed Expand Collapse
id: String

The unique ID of the list.

created_on: String

The RFC 3339 timestamp of when the list was created.

modified_on: String

The RFC 3339 timestamp of when the list was last modified.

num_items: Float64

The number of items in the list.

num_referencing_filters: Float64

The number of filters referencing the list.

cloudflare_list

resource "cloudflare_list" "example_list" {
  account_id = "023e105f4ecef8ad9ca31a8372d0c353"
  kind = "ip"
  name = "list1"
  description = "This is a note"
}

data cloudflare_list

required Expand Collapse
list_id: String

The unique ID of the list.

account_id: String

The Account ID for this resource.

computed Expand Collapse
id: String

The unique ID of the list.

created_on: String

The RFC 3339 timestamp of when the list was created.

description: String

An informative summary of the list.

kind: String

The type of the list. Each type supports specific list items (IP addresses, ASNs, hostnames or redirects).

modified_on: String

The RFC 3339 timestamp of when the list was last modified.

name: String

An informative name for the list. Use this name in filter and rule expressions.

num_items: Float64

The number of items in the list.

num_referencing_filters: Float64

The number of filters referencing the list.

cloudflare_list

data "cloudflare_list" "example_list" {
  account_id = "023e105f4ecef8ad9ca31a8372d0c353"
  list_id = "2c0fc9fa937b11eaa1b71c4d701ab86e"
}

data cloudflare_lists

required Expand Collapse
account_id: String

The Account ID for this resource.

optional Expand Collapse
max_items?: Int64

Max items to fetch, default: 1000

computed Expand Collapse
result: List[Attributes]

The items returned by the data source

id: String

The unique ID of the list.

created_on: String

The RFC 3339 timestamp of when the list was created.

kind: String

The type of the list. Each type supports specific list items (IP addresses, ASNs, hostnames or redirects).

modified_on: String

The RFC 3339 timestamp of when the list was last modified.

name: String

An informative name for the list. Use this name in filter and rule expressions.

num_items: Float64

The number of items in the list.

num_referencing_filters: Float64

The number of filters referencing the list.

description: String

An informative summary of the list.

cloudflare_lists

data "cloudflare_lists" "example_lists" {
  account_id = "023e105f4ecef8ad9ca31a8372d0c353"
}

Rules ListsListsItems

resource cloudflare_list_item

required Expand Collapse
account_id: String

The Account ID for this resource.

list_id: String

The unique ID of the list.

body: List[Attributes]
ip?: String

An IPv4 address, an IPv4 CIDR, an IPv6 address, or an IPv6 CIDR.

comment?: String

Defines an informative summary of the list item.

redirect?: Attributes

The definition of the redirect.

source_url: String
target_url: String
include_subdomains?: Bool
preserve_path_suffix?: Bool
preserve_query_string?: Bool
status_code?: Int64
subpath_matching?: Bool
hostname?: Attributes

Valid characters for hostnames are ASCII(7) letters from a to z, the digits from 0 to 9, wildcards (*), and the hyphen (-).

url_hostname: String
exclude_exact_hostname?: Bool

Only applies to wildcard hostnames (e.g., *.example.com). When true (default), only subdomains are blocked. When false, both the root domain and subdomains are blocked.

asn?: Int64

Defines a non-negative 32 bit integer.

optional Expand Collapse
item_id?: String

Defines the unique ID of the item in the List.

computed Expand Collapse
asn: Int64

Defines a non-negative 32 bit integer.

comment: String

Defines an informative summary of the list item.

created_on: String

The RFC 3339 timestamp of when the list was created.

id: String

Defines the unique ID of the item in the List.

ip: String

An IPv4 address, an IPv4 CIDR, an IPv6 address, or an IPv6 CIDR.

modified_on: String

The RFC 3339 timestamp of when the list was last modified.

operation_id: String

The unique operation ID of the asynchronous action.

hostname: Attributes

Valid characters for hostnames are ASCII(7) letters from a to z, the digits from 0 to 9, wildcards (*), and the hyphen (-).

url_hostname: String
exclude_exact_hostname: Bool

Only applies to wildcard hostnames (e.g., *.example.com). When true (default), only subdomains are blocked. When false, both the root domain and subdomains are blocked.

redirect: Attributes

The definition of the redirect.

source_url: String
target_url: String
include_subdomains: Bool
preserve_path_suffix: Bool
preserve_query_string: Bool
status_code: Int64
subpath_matching: Bool

cloudflare_list_item

resource "cloudflare_list_item" "example_list_item" {
  account_id = "023e105f4ecef8ad9ca31a8372d0c353"
  list_id = "2c0fc9fa937b11eaa1b71c4d701ab86e"
  body = [{
    ip = "10.0.0.1"
    comment = "Private IP address"
  }]
}

data cloudflare_list_item

required Expand Collapse
account_id: String

The Account ID for this resource.

item_id: String

Defines the unique ID of the item in the List.

list_id: String

The unique ID of the list.

computed Expand Collapse
asn: Int64

Defines a non-negative 32 bit integer.

comment: String

Defines an informative summary of the list item.

created_on: String

The RFC 3339 timestamp of when the list was created.

id: String

Defines the unique ID of the item in the List.

ip: String

An IPv4 address, an IPv4 CIDR, an IPv6 address, or an IPv6 CIDR.

modified_on: String

The RFC 3339 timestamp of when the list was last modified.

hostname: Attributes

Valid characters for hostnames are ASCII(7) letters from a to z, the digits from 0 to 9, wildcards (*), and the hyphen (-).

url_hostname: String
exclude_exact_hostname: Bool

Only applies to wildcard hostnames (e.g., *.example.com). When true (default), only subdomains are blocked. When false, both the root domain and subdomains are blocked.

redirect: Attributes

The definition of the redirect.

source_url: String
target_url: String
include_subdomains: Bool
preserve_path_suffix: Bool
preserve_query_string: Bool
status_code: Int64
subpath_matching: Bool

cloudflare_list_item

data "cloudflare_list_item" "example_list_item" {
  account_id = "023e105f4ecef8ad9ca31a8372d0c353"
  list_id = "2c0fc9fa937b11eaa1b71c4d701ab86e"
  item_id = "34b12448945f11eaa1b71c4d701ab86e"
}

data cloudflare_list_items

required Expand Collapse
account_id: String

The Account ID for this resource.

list_id: String

The unique ID of the list.

optional Expand Collapse
per_page?: Int64

Amount of results to include in each paginated response. A non-negative 32 bit integer.

max_items?: Int64

Max items to fetch, default: 1000

computed Expand Collapse
result: List[Attributes]

The items returned by the data source

id: String

Defines the unique ID of the item in the List.

created_on: String

The RFC 3339 timestamp of when the list was created.

ip: String

An IPv4 address, an IPv4 CIDR, an IPv6 address, or an IPv6 CIDR.

modified_on: String

The RFC 3339 timestamp of when the list was last modified.

comment: String

Defines an informative summary of the list item.

hostname: Attributes

Valid characters for hostnames are ASCII(7) letters from a to z, the digits from 0 to 9, wildcards (*), and the hyphen (-).

url_hostname: String
exclude_exact_hostname: Bool

Only applies to wildcard hostnames (e.g., *.example.com). When true (default), only subdomains are blocked. When false, both the root domain and subdomains are blocked.

redirect: Attributes

The definition of the redirect.

source_url: String
target_url: String
include_subdomains: Bool
preserve_path_suffix: Bool
preserve_query_string: Bool
status_code: Int64
subpath_matching: Bool
asn: Int64

Defines a non-negative 32 bit integer.

cloudflare_list_items

data "cloudflare_list_items" "example_list_items" {
  account_id = "023e105f4ecef8ad9ca31a8372d0c353"
  list_id = "2c0fc9fa937b11eaa1b71c4d701ab86e"
  per_page = 1
  search = "1.1.1."
}