Workers Terraform provider improvements and API SDK fixes
Cloudflare Terraform Provider and SDK releases bring improvements to Workers deployment experience, including Python Workers support in Terraform, fixes for unwarranted plan diffs and file management, and SDK enhancements for file uploads and KV value handling. These updates reduce noise in Terraform plans and improve reliability for Workers developers.
The recent Cloudflare Terraform Provider ↗ and SDK releases (such as cloudflare-typescript ↗) bring significant improvements to the Workers developer experience. These updates focus on reliability, performance, and adding Python Workers support.
Terraform Improvements
Fixed Unwarranted Plan Diffs
Resolved several issues with the cloudflare_workers_script resource that resulted in unwarranted plan diffs, including:
- Using Durable Objects migrations
- Using some bindings such as
secret_text - Using smart placement
A resource should never show a plan diff if there isn't an actual change. This fix reduces unnecessary noise in your Terraform plan and is available in Cloudflare Terraform Provider 5.8.0.
Improved File Management
You can now specify content_file and content_sha256 instead of content. This prevents the Workers script content from being stored in the state file which greatly reduces plan diff size and noise. If your workflow synced plans remotely, this should now happen much faster since there is less data to sync. This is available in Cloudflare Terraform Provider 5.7.0.
resource "cloudflare_workers_script" "my_worker" {
account_id = "123456789"
script_name = "my_worker"
main_module = "worker.mjs"
content_file = "worker.mjs"
content_sha256 = filesha256("worker.mjs")
}
Assets Headers and Redirects Support
Fixed the cloudflare_workers_script resource to properly support headers and redirects for Assets:
resource "cloudflare_workers_script" "my_worker" {
account_id = "123456789"
script_name = "my_worker"
main_module = "worker.mjs"
content_file = "worker.mjs"
content_sha256 = filesha256("worker.mjs")
assets = {
config = {
headers = file("_headers")
redirects = file("_redirects")
}
# Completion jwt from:
# https://developers.cloudflare.com/api/resources/workers/subresources/assets/subresources/upload/
jwt = "jwt"
}
}
Available in Cloudflare Terraform Provider 5.8.0.
Python Workers Support
Added support for uploading Python Workers (beta) in Terraform. You can now deploy Python Workers with:
resource "cloudflare_workers_script" "my_worker" {
account_id = "123456789"
script_name = "my_worker"
content_file = "worker.py"
content_sha256 = filesha256("worker.py")
content_type = "text/x-python"
}
Available in Cloudflare Terraform Provider 5.8.0.
SDK Enhancements
Improved File Upload API
Fixed an issue where Workers script versions in the SDK did not allow uploading files. This now works, and also has an improved files upload interface:
const scriptContent = `
export default {
async fetch(request, env, ctx) {
return new Response('Hello World!', { status: 200 });
}
};
`;
client.workers.scripts.versions.create('my-worker', {
account_id: '123456789',
metadata: {
main_module: 'my-worker.mjs',
},
files: [
await toFile(
Buffer.from(scriptContent),
'my-worker.mjs',
{
type: "application/javascript+module",
}
)
]
});
Will be available in cloudflare-typescript 4.6.0. A similar change will be available in cloudflare-python 4.4.0.
Fixed updating KV values
Previously when creating a KV value like this:
await cf.kv.namespaces.values.update("my-kv-namespace", "key1", {
account_id: "123456789",
metadata: "my metadata",
value: JSON.stringify({
hello: "world"
})
});
...and recalling it in your Worker like this:
const value = await c.env.KV.get<{hello: string}>("key1", "json");
You'd get back this: {metadata:'my metadata', value:"{'hello':'world'}"} instead of the correct value of {hello: 'world'}
This is fixed in cloudflare-typescript 4.5.0 and will be fixed in cloudflare-python 4.4.0.
Source: original entry ↗
More from Cloudflare
Follow Cloudflare to get its new changes in your feed and email digest.
Cloudflare One Client for macOS 2026.8.2100.0
GA release for macOS Cloudflare One Client with improved split tunnel handling that no longer briefly blocks traffic during reconnects, support for non-RFC 1918 local IPv4 networks, faster connects with lower memory use, and numerous reliability fixes across DNS, reauthentication, and client stability.
Cloudflare One Client for Windows 2026.8.2100.0
This GA release improves split tunnel reliability, adds support for non-RFC 1918 local networks, optimizes connection performance with faster reconnections and lower memory usage, and includes numerous bug fixes for DNS, registration, and network handling. The client now features a service recovery mechanism that automatically restarts on system unlock and better handles large hosts files without blocking traffic.
Cloudflare One Client for Linux 2026.8.2100.0
New GA release for Linux with improved split tunnel handling that no longer briefly blocks traffic during reconnects, support for non-RFC 1918 local IPv4 networks, faster tunnel reconnections, and lower memory usage. Includes numerous stability and reliability fixes for DNS, reconnection behavior, and crash issues.