Skip to content

Commit 0c0bed2

Browse files
committed
add resource provisioning beta
1 parent 537312f commit 0c0bed2

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
pcx_content_type: concept
3+
title: Resource Provisioning
4+
description: Automatically provision Cloudflare resources when deploying your Worker with bindings.
5+
sidebar:
6+
badge:
7+
text: Beta
8+
---
9+
10+
# Resource Provisioning
11+
You can now automatically provision Cloudflare resources as part of your deployment. Without this, you need to separately manually create any resouces that do not yet exist on your account prior to deploying.
12+
13+
With resource provisioning, if your Wrangler configuration file includes a [KV namespace](/kv/), [D1 database](/d1/), or [R2 bucket](/r2/) that does not yet exist, Wrangler will create these resources upon deployment. This is done by adding the experimental `–x-provision` flag to your commands.
14+
15+
## Wrangler Configuration
16+
You can set up your Wrangler configuration file like the following:
17+
```json
18+
{
19+
"kv_namespaces": [
20+
{
21+
"binding": "MY_KV"
22+
}
23+
],
24+
"r2_buckets": [
25+
{
26+
"binding": "MY_R2"
27+
}
28+
],
29+
"d1_databases": [
30+
{
31+
"binding": "MY_D1"
32+
}
33+
]
34+
}
35+
```
36+
When using the experimental `–x-provision` flag, the `id` field for KV and D1 and the `bucket_name` for R2 are optional in your wrangler configuration.
37+
38+
## Developing locally and deploying
39+
When developing locally, you can interact with local versions of any KV, D1, R2 resources configured in your Wrangler configuration file by running:
40+
41+
```sh
42+
npx wrangler dev –x-provision
43+
```
44+
45+
When you're ready to deploy, run:
46+
47+
```sh
48+
npx wrangler deploy –x-provision
49+
```
50+
51+
Upon deploy Wrangler will automatically create the resources that do not yet exist on your accound and bind them to your Worker. The newly created resource will be named with the format `<worker-name>-<binding-name>` by default.
52+
53+
## Feedback
54+
Resource provisiong is currently a beta feature. If you run into issues or would like to leave feedback for the team to help us improve, please send us a message in our [Cloudflare Developers Discord](https://discord.cloudflare.com/) in the [Wrangler channel](https://discord.com/channels/595317990191398933/799437470004412476).

0 commit comments

Comments
 (0)