Deploy a Cloudflare Worker script (with an optional route) via the Cloudflare Terraform provider
Qovery creates it in your account with a third-party provider, using credentials you enter in the form, as a Blueprint service in one of your environments.
New to this? You don’t need to know Terraform or Kubernetes. Qovery sets up Cloudflare Workers in your account with the provider: you fill in a form, or paste the prompt below into your coding agent. The values it publishes, listed under Outputs, reach your other services as environment variables. Qovery tells you when a newer version of the Blueprint is available. Check the requirements in the Reference section before you start, and try it first in a development environment.
Open the environment, then New service › Blueprint.
Find Cloudflare Workers in the catalog and pick the major version.
Fill in the variables. Required ones are marked; the others use their defaults.
Create the service, and deploy it now or later.
List the catalog to get the latest tag, then create the service from it. qovery api signs the requests with your CLI session.
ORG_ID="REPLACE_WITH_ORGANIZATION_ID"ENV_ID="REPLACE_WITH_ENVIRONMENT_ID"qovery api "organization/$ORG_ID/blueprint/catalog" | jq '.. | objects | select(.name? == "cloudflare-workers")'cat > blueprint.json <<'EOF'{ "name": "cloudflare-workers", "tag": "EXTERNAL/cloudflare-workers/default/1.0.8", "icon": "app://qovery-console/cloudflare", "variables": [ { "name": "cloudflare_api_token", "value": "REPLACE_WITH_CLOUDFLARE_API_TOKEN", "is_secret": true }, { "name": "account_id", "value": "REPLACE_WITH_ACCOUNT_ID" }, { "name": "script_name", "value": "REPLACE_WITH_SCRIPT_NAME" } ], "spec_overrides": { "engine_version": "1.9.7" }}EOFBLUEPRINT_ID=$(qovery api "environment/$ENV_ID/blueprint" --method POST --input - < blueprint.json | jq -r .id)rm blueprint.json # it can hold secret valuesqovery api "blueprint/$BLUEPRINT_ID/deploy" --method POSTqovery api "blueprint/$BLUEPRINT_ID" # status of the latest deployment
Replace each REPLACE_WITH_ value. Add optional variables to variables the same way.
Paste this into Claude Code, Cursor, Codex or another coding agent with the Qovery agent skills installed (curl -fsSL https://skill.qovery.com/install.sh | bash).
Prompt
Add the Qovery Blueprint Cloudflare Workers (cloudflare-workers) to one of my Qovery environments and deploy it. Ask me for cloudflare_api_token, account_id and script_name.Ask me before deploying to a production environment.Docs: https://www.qovery.com/docs/configuration/blueprints/cloudflare-workers.md
You don’t add any file to your repository. Qovery creates the Blueprint from the Console or the API.
Generated from qbm.yml at EXTERNAL/cloudflare-workers/default/1.0.8, the manifest the Console form is built from.
All 8 variables
Name
Type
Required
Default
Secret
Description
cloudflare_api_token
string
Yes
Yes
Needs Workers Scripts edit, plus Workers Routes edit when using a route
account_id
string
Yes
Cloudflare account ID that owns the Worker
script_name
string
Yes
Lowercase letters, digits, hyphens, underscores
script_content
string
addEventListener('fetch', (event) => { event.respondWith(new Response('Hello from a Qovery-managed Cloudflare Worker')); });
Worker script source. Defaults to a hello-world service-worker script.
main_module
string
Entrypoint module name for ES-module Workers (e.g. worker.js). Empty = service-worker syntax.
compatibility_date
string
2024-09-23
Workers runtime compatibility date, YYYY-MM-DD
route_zone_id
string
Zone ID to attach a route on. Empty = no route.
route_pattern
string
Route pattern that triggers the Worker (e.g. example.com/*). Required when route_zone_id is set.
Outputs become environment variables that other services in the environment can use. By default Qovery also creates an alias for each output, prefixed with the Blueprint’s name; see Aliases Qovery creates for outputs for the naming rules and the cases where no alias is created.
All 4 outputs
Name
Secret
Description
script_name
Deployed Worker script name
script_id
Worker script ID
route_id
Worker route ID (empty when no route is configured)
route_pattern
URL pattern the Worker responds on (empty when no route is configured)
Secret variables and outputs are encrypted and masked in Qovery, but Terraform can also keep their values, and values derived from them, in its state. With the Qovery-managed state backend (the default), Qovery stores the state. If you use your own backend, protect it and keep state files out of version control.
From the Blueprint’s README.Deploys a Cloudflare Worker script (cloudflare_workers_script) with an optional route (cloudflare_workers_route), via the official cloudflare/cloudflare Terraform provider (~> 5.0).
Authentication is a Cloudflare API token supplied as the sensitive cloudflare_api_token variable (credentials.default: env — there are no cluster credentials to reuse for a third-party provider). The token needs Workers Scripts: Edit (and Workers Routes: Edit if you set a route).
The default script_content uses service-worker syntax (addEventListener), so main_module is left empty. For ES-module Workers (export default { fetch }), set main_module (e.g. worker.js).
Provider pinned to cloudflare/cloudflare ~> 5.0 (v5 renamed the resource from cloudflare_worker_script to cloudflare_workers_script).