Skip to content

fix(workers_script): add missing "worker_loader" binding type with acceptance test - #7310

Open
jackemcpherson wants to merge 1 commit into
cloudflare:mainfrom
jackemcpherson:fix-workers-script-worker-loader-binding
Open

fix(workers_script): add missing "worker_loader" binding type with acceptance test#7310
jackemcpherson wants to merge 1 commit into
cloudflare:mainfrom
jackemcpherson:fix-workers-script-worker-loader-binding

Conversation

@jackemcpherson

Copy link
Copy Markdown
  • I understand that this repository is auto-generated and my pull request may not be merged

Changes being requested

The cloudflare_workers_script resource reads a worker_loader binding from a
deployed Worker into state, but the schema validator rejects the same type in
configuration with Invalid Attribute Value Match. Any Worker with a Worker
Loader binding therefore shows a permanent plan diff that proposes removal of a
binding the configuration cannot declare.

This change mirrors #6912, which fixed the same defect class for the
ratelimit type:

  • Add worker_loader to the OneOfCaseInsensitive validator list and to the
    type attribute description in internal/services/workers_script/schema.go.
  • Update the matching description in docs/resources/workers_script.md.
  • Add an acceptance test and a test fixture.

A worker_loader binding needs only name and type. Both attributes already
exist in the model and the Read path already decodes the type, so no model
changes are needed.

schema.go is generated by Stainless. This is a hand patch, as in #6912, so
the OpenAPI spec may need reconciliation.

Fixes #7309

Acceptance test run results

  • I have added or updated acceptance tests for my changes
  • I have run acceptance tests for my changes and included the results below

Steps to run acceptance tests

CLOUDFLARE_API_TOKEN=<token> CLOUDFLARE_ACCOUNT_ID=<account id> TF_ACC=1 go test -run TestAccCloudflareWorkerScript_WorkerLoaderBinding -v -timeout 30m ./internal/services/workers_script/

Test output

=== RUN   TestAccCloudflareWorkerScript_WorkerLoaderBinding
=== PAUSE TestAccCloudflareWorkerScript_WorkerLoaderBinding
=== CONT  TestAccCloudflareWorkerScript_WorkerLoaderBinding
--- PASS: TestAccCloudflareWorkerScript_WorkerLoaderBinding (6.31s)
PASS
ok      github.com/cloudflare/terraform-provider-cloudflare/internal/services/workers_script   8.596s

Additional context & links

The equivalent Wrangler configuration for this binding is
worker_loaders = [{ binding = "LOADER" }].

…ceptance test

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@jackemcpherson
jackemcpherson marked this pull request as ready for review August 14, 2026 22:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cloudflare_workers_script: worker_loader binding type is read into state but rejected by the schema validator

1 participant