---
title: KV
---

[Skip to content](#_top)

[API Reference](https://developers.cloudflare.com/api/terraform)

Copy Markdown

Open in **Claude**Open in **ChatGPT**Open in **Cursor**

---

**Copy Markdown****View as Markdown**

# KV

#### KVNamespaces

#### resource cloudflare\_workers\_kv\_namespace

##### required Expand Collapse

account\_id: String

ID of the Cloudflare account that owns the Workers KV namespaces.

[Link to this property](<#(resource)%20kv.namespaces%20%3E%20(terraform%20resource)%20%3E%20(attribute)%20account_id>)

title: String

Human-readable string name for a Workers KV namespace.

[Link to this property](<#(resource)%20kv.namespaces%20%3E%20(terraform%20resource)%20%3E%20(attribute)%20title>)

##### optional Expand Collapse

jurisdiction?: String

Specify the jurisdiction to restrict the KV namespace to durably store data within. Can only be set at namespace creation time.

[Link to this property](<#(resource)%20kv.namespaces%20%3E%20(terraform%20resource)%20%3E%20(attribute)%20jurisdiction>)

mode?: String

The mode of the Workers KV namespace. Specify `instant` when creating a namespace to create a KV Instant namespace. Omit this field when creating a namespace to create a classic namespace. Currently, `instant` is the only supported explicit value.

[Link to this property](<#(resource)%20kv.namespaces%20%3E%20(terraform%20resource)%20%3E%20(attribute)%20mode>)

##### computed Expand Collapse

id: String

ID of the Workers KV namespace.

[Link to this property](<#(resource)%20kv.namespaces%20%3E%20(terraform%20resource)%20%3E%20(attribute)%20id>)

supports\_url\_encoding: Bool

True if keys written on the URL will be URL-decoded before storing. For example, if set to “true”, a key written on the URL as “%3F” will be stored as ”?”.

[Link to this property](<#(resource)%20kv.namespaces%20%3E%20(terraform%20resource)%20%3E%20(attribute)%20supports_url_encoding>)

### cloudflare\_workers\_kv\_namespace

Terraform

HTTPTypeScriptPythonGoTerraform

```
resource "cloudflare_workers_kv_namespace" "example_workers_kv_namespace" {
  account_id = "023e105f4ecef8ad9ca31a8372d0c353"
  title = "My Own Namespace"
  jurisdiction = "eu"
  mode = "instant"
}
```

#### data cloudflare\_workers\_kv\_namespace

##### required Expand Collapse

account\_id: String

ID of the Cloudflare account that owns the Workers KV namespaces.

[Link to this property](<#(resource)%20kv.namespaces%20%3E%20(terraform%20datasource-single)%20%3E%20(attribute)%20account_id>)

##### optional Expand Collapse

namespace\_id?: String

ID of the Workers KV namespace.

[Link to this property](<#(resource)%20kv.namespaces%20%3E%20(terraform%20datasource-single)%20%3E%20(attribute)%20namespace_id>)

<details>

<summary>

filter?: Attributes

</summary>

direction?: String

Sort namespaces in ascending (<code>asc</code>) or descending (<code>desc</code>) order.

<a href="#(resource)%20kv.namespaces%20%3E%20(terraform%20datasource-single)%20%3E%20(attribute)%20filter%20%3E%20(attribute)%20direction">Link to this property</a>

order?: String

Namespace field to sort by (<code>id</code> or <code>title</code>).

<a href="#(resource)%20kv.namespaces%20%3E%20(terraform%20datasource-single)%20%3E%20(attribute)%20filter%20%3E%20(attribute)%20order">Link to this property</a>

</details>

[Link to this property](<#(resource)%20kv.namespaces%20%3E%20(terraform%20datasource-single)%20%3E%20(attribute)%20filter>)

##### computed Expand Collapse

id: String

ID of the Workers KV namespace.

[Link to this property](<#(resource)%20kv.namespaces%20%3E%20(terraform%20datasource-single)%20%3E%20(attribute)%20id>)

jurisdiction: String

Specify the jurisdiction to restrict the KV namespace to durably store data within. Can only be set at namespace creation time.

[Link to this property](<#(resource)%20kv.namespaces%20%3E%20(terraform%20datasource-single)%20%3E%20(attribute)%20jurisdiction>)

mode: String

The mode of the Workers KV namespace. Specify `instant` when creating a namespace to create a KV Instant namespace. Omit this field when creating a namespace to create a classic namespace. Currently, `instant` is the only supported explicit value.

[Link to this property](<#(resource)%20kv.namespaces%20%3E%20(terraform%20datasource-single)%20%3E%20(attribute)%20mode>)

supports\_url\_encoding: Bool

True if keys written on the URL will be URL-decoded before storing. For example, if set to “true”, a key written on the URL as “%3F” will be stored as ”?”.

[Link to this property](<#(resource)%20kv.namespaces%20%3E%20(terraform%20datasource-single)%20%3E%20(attribute)%20supports_url_encoding>)

title: String

Human-readable string name for a Workers KV namespace.

[Link to this property](<#(resource)%20kv.namespaces%20%3E%20(terraform%20datasource-single)%20%3E%20(attribute)%20title>)

### cloudflare\_workers\_kv\_namespace

Terraform

HTTPTypeScriptPythonGoTerraform

```
data "cloudflare_workers_kv_namespace" "example_workers_kv_namespace" {
  account_id = "023e105f4ecef8ad9ca31a8372d0c353"
  namespace_id = "0f2ac74b498b48028cb68387c421e279"
}
```

#### data cloudflare\_workers\_kv\_namespaces

##### required Expand Collapse

account\_id: String

ID of the Cloudflare account that owns the Workers KV namespaces.

[Link to this property](<#(resource)%20kv.namespaces%20%3E%20(terraform%20datasource-plural)%20%3E%20(attribute)%20account_id>)

##### optional Expand Collapse

direction?: String

Sort namespaces in ascending (`asc`) or descending (`desc`) order.

[Link to this property](<#(resource)%20kv.namespaces%20%3E%20(terraform%20datasource-plural)%20%3E%20(attribute)%20direction>)

order?: String

Namespace field to sort by (`id` or `title`).

[Link to this property](<#(resource)%20kv.namespaces%20%3E%20(terraform%20datasource-plural)%20%3E%20(attribute)%20order>)

max\_items?: Int64

Max items to fetch, default: 1000

[Link to this property](<#(resource)%20kv.namespaces%20%3E%20(terraform%20datasource-plural)%20%3E%20(attribute)%20max_items>)

##### computed Expand Collapse

<details>

<summary>

result: List\[Attributes]

The items returned by the data source

</summary>

id: String

ID of the Workers KV namespace.

<a href="#(resource)%20kv.namespaces%20%3E%20(terraform%20datasource-plural)%20%3E%20(attribute)%20result%20%3E%20(attribute)%20id">Link to this property</a>

title: String

Human-readable string name for a Workers KV namespace.

<a href="#(resource)%20kv.namespaces%20%3E%20(terraform%20datasource-plural)%20%3E%20(attribute)%20result%20%3E%20(attribute)%20title">Link to this property</a>

jurisdiction: String

Specify the jurisdiction to restrict the KV namespace to durably store data within. Can only be set at namespace creation time.

<a href="#(resource)%20kv.namespaces%20%3E%20(terraform%20datasource-plural)%20%3E%20(attribute)%20result%20%3E%20(attribute)%20jurisdiction">Link to this property</a>

mode: String

The mode of the Workers KV namespace. Specify <code>instant</code> when creating a namespace to create a KV Instant namespace. Omit this field when creating a namespace to create a classic namespace. Currently, <code>instant</code> is the only supported explicit value.

<a href="#(resource)%20kv.namespaces%20%3E%20(terraform%20datasource-plural)%20%3E%20(attribute)%20result%20%3E%20(attribute)%20mode">Link to this property</a>

supports\_url\_encoding: Bool

True if keys written on the URL will be URL-decoded before storing. For example, if set to “true”, a key written on the URL as “%3F” will be stored as ”?”.

<a href="#(resource)%20kv.namespaces%20%3E%20(terraform%20datasource-plural)%20%3E%20(attribute)%20result%20%3E%20(attribute)%20supports_url_encoding">Link to this property</a>

</details>

[Link to this property](<#(resource)%20kv.namespaces%20%3E%20(terraform%20datasource-plural)%20%3E%20(attribute)%20result>)

### cloudflare\_workers\_kv\_namespaces

Terraform

HTTPTypeScriptPythonGoTerraform

```
data "cloudflare_workers_kv_namespaces" "example_workers_kv_namespaces" {
  account_id = "023e105f4ecef8ad9ca31a8372d0c353"
  direction = "asc"
  order = "id"
}
```

#### KVNamespacesValues

#### resource cloudflare\_workers\_kv

##### required Expand Collapse

key\_name: String

A key’s name. The name may be at most 512 bytes. All printable, non-whitespace characters are valid. Use percent-encoding to define key names as part of a URL.

[Link to this property](<#(resource)%20kv.namespaces.values%20%3E%20(terraform%20resource)%20%3E%20(attribute)%20key_name>)

account\_id: String

ID of the Cloudflare account that owns the Workers KV namespaces.

[Link to this property](<#(resource)%20kv.namespaces.values%20%3E%20(terraform%20resource)%20%3E%20(attribute)%20account_id>)

namespace\_id: String

ID of the Workers KV namespace.

[Link to this property](<#(resource)%20kv.namespaces.values%20%3E%20(terraform%20resource)%20%3E%20(attribute)%20namespace_id>)

value: String

A byte sequence to be stored, up to 25 MiB in length.

[Link to this property](<#(resource)%20kv.namespaces.values%20%3E%20(terraform%20resource)%20%3E%20(attribute)%20value>)

##### optional Expand Collapse

metadata?: JSON

Associates arbitrary JSON data with a key/value pair.

[Link to this property](<#(resource)%20kv.namespaces.values%20%3E%20(terraform%20resource)%20%3E%20(attribute)%20metadata>)

##### computed Expand Collapse

id: String

A key’s name. The name may be at most 512 bytes. All printable, non-whitespace characters are valid. Use percent-encoding to define key names as part of a URL.

[Link to this property](<#(resource)%20kv.namespaces.values%20%3E%20(terraform%20resource)%20%3E%20(attribute)%20id>)

### cloudflare\_workers\_kv

Terraform

HTTPTypeScriptPythonGoTerraform

```
resource "cloudflare_workers_kv" "example_workers_kv" {
  account_id = "023e105f4ecef8ad9ca31a8372d0c353"
  namespace_id = "0f2ac74b498b48028cb68387c421e279"
  key_name = "My-Key"
  value = "Some Value"
  metadata = {

  }
}
```

#### data cloudflare\_workers\_kv

##### required Expand Collapse

key\_name: String

A key’s name. The name may be at most 512 bytes. All printable, non-whitespace characters are valid. Use percent-encoding to define key names as part of a URL.

[Link to this property](<#(resource)%20kv.namespaces.values%20%3E%20(terraform%20datasource-single)%20%3E%20(attribute)%20key_name>)

account\_id: String

ID of the Cloudflare account that owns the Workers KV namespaces.

[Link to this property](<#(resource)%20kv.namespaces.values%20%3E%20(terraform%20datasource-single)%20%3E%20(attribute)%20account_id>)

namespace\_id: String

ID of the Workers KV namespace.

[Link to this property](<#(resource)%20kv.namespaces.values%20%3E%20(terraform%20datasource-single)%20%3E%20(attribute)%20namespace_id>)

##### computed Expand Collapse

id: String

A key’s name. The name may be at most 512 bytes. All printable, non-whitespace characters are valid. Use percent-encoding to define key names as part of a URL.

[Link to this property](<#(resource)%20kv.namespaces.values%20%3E%20(terraform%20datasource-single)%20%3E%20(attribute)%20id>)

value: JSON

[Link to this property](<#(resource)%20kv.namespaces.values%20%3E%20(terraform%20datasource-single)%20%3E%20(attribute)%20value>)

### cloudflare\_workers\_kv

Terraform

HTTPTypeScriptPythonGoTerraform

```
data "cloudflare_workers_kv" "example_workers_kv" {
  account_id = "023e105f4ecef8ad9ca31a8372d0c353"
  namespace_id = "0f2ac74b498b48028cb68387c421e279"
  key_name = "My-Key"
}
```