Beta
BetaWorkers
resource cloudflare_worker
cloudflare_worker
resource "cloudflare_worker" "example_worker" {
account_id = "023e105f4ecef8ad9ca31a8372d0c353"
name = "my-worker"
logpush = true
observability = {
enabled = true
head_sampling_rate = 1
logs = {
destinations = ["string"]
enabled = true
head_sampling_rate = 1
invocation_logs = true
persist = true
}
traces = {
destinations = ["string"]
enabled = true
head_sampling_rate = 1
persist = true
}
}
subdomain = {
enabled = true
previews_enabled = true
}
tags = ["my-team", "my-public-api"]
tail_consumers = [{
name = "my-tail-consumer"
}]
}
data cloudflare_workers
optional
cloudflare_workers
data "cloudflare_workers" "example_workers" {
account_id = "023e105f4ecef8ad9ca31a8372d0c353"
}
BetaWorkersVersions
resource cloudflare_worker_version
required
optional
Date indicating targeted support in the Workers runtime. Backwards incompatible fixes to the runtime following this date will not affect this Worker.
The name of the main module in the modules array (e.g. the name of the module that exports a fetch handler).
computed
Time in milliseconds spent on Worker startup.
cloudflare_worker_version
resource "cloudflare_worker_version" "example_worker_version" {
account_id = "023e105f4ecef8ad9ca31a8372d0c353"
worker_id = "worker_id"
annotations = {
workers_message = "Fixed bug."
workers_tag = "v1.0.1"
}
assets = {
config = {
html_handling = "auto-trailing-slash"
not_found_handling = "404-page"
run_worker_first = ["string"]
}
jwt = "jwt"
}
bindings = [{
name = "MY_ENV_VAR"
text = "my_data"
type = "plain_text"
}]
compatibility_date = "2021-01-01"
compatibility_flags = ["nodejs_compat"]
limits = {
cpu_ms = 50
}
main_module = "index.js"
migrations = {
deleted_classes = ["string"]
new_classes = ["string"]
new_sqlite_classes = ["string"]
new_tag = "v2"
old_tag = "v1"
renamed_classes = [{
from = "from"
to = "to"
}]
transferred_classes = [{
from = "from"
from_script = "from_script"
to = "to"
}]
}
modules = [{
content_base64 = "ZXhwb3J0IGRlZmF1bHQgewogIGFzeW5jIGZldGNoKHJlcXVlc3QsIGVudiwgY3R4KSB7CiAgICByZXR1cm4gbmV3IFJlc3BvbnNlKCdIZWxsbyBXb3JsZCEnKQogIH0KfQ=="
content_type = "application/javascript+module"
name = "index.js"
}]
placement = {
mode = "smart"
}
usage_model = "standard"
}
data cloudflare_worker_version
required
optional
computed
Identifier for the version, which can be a UUID, a UUID prefix (minimum length 8), or the literal "latest" to operate on the most recently created version.
Date indicating targeted support in the Workers runtime. Backwards incompatible fixes to the runtime following this date will not affect this Worker.
The name of the main module in the modules array (e.g. the name of the module that exports a fetch handler).
Time in milliseconds spent on Worker startup.
Flags that enable or disable certain features in the Workers runtime. Used to enable upcoming features or opt in or out of specific changes not included in a compatibility_date.
cloudflare_worker_version
data "cloudflare_worker_version" "example_worker_version" {
account_id = "023e105f4ecef8ad9ca31a8372d0c353"
worker_id = "worker_id"
version_id = "version_id"
include = "modules"
}
data cloudflare_worker_versions
required
cloudflare_worker_versions
data "cloudflare_worker_versions" "example_worker_versions" {
account_id = "023e105f4ecef8ad9ca31a8372d0c353"
worker_id = "worker_id"
}