Skip to content

cloudflare_workers_script randomly fails to deploy when changing compatibility_date #5704

@garysassano

Description

@garysassano

Confirmation

  • This is a bug with an existing resource and is not a feature request or enhancement. Feature requests should be submitted with Cloudflare Support or your account team.
  • I have searched the issue tracker and my issue isn't already found.
  • I have replicated my issue using the latest version of the provider and it is still present.

Terraform and Cloudflare provider version

Terraform v1.12.2
Cloudflare provider v5.6.0

Affected resource(s)

cloudflare_workers_script

Terraform configuration files

const playwrightWorker = new WorkersScript(this, "PlaywrightWorker", {
	accountId: mainAccountId,
	scriptName: "playwright-worker",
	content: Fn.sensitive(
		Fn.file(join(__dirname, "../functions/playwright", "index.js")),
	),
	mainModule: "index.js",
	compatibilityFlags: ["nodejs_compat_v2"],
	compatibilityDate: "2025-06-30",
	bindings: [
		{
			type: "browser",
			name: "MYBROWSER",
		},
	],
});

Link to debug output

none

Panic output

No response

Expected output

Apply complete! Resources: 0 added, 1 changed, 0 destroyed.

Actual output

 Terraform will perform the following actions:

   # cloudflare_workers_script.PlaywrightWorker (PlaywrightWorker) will be updated in-place
   ~ resource "cloudflare_workers_script" "PlaywrightWorker" {
       ~ bindings            = [
           ~ {
                 name         = "MYBROWSER"
               + namespace_id = (known after apply)
                 # (1 unchanged attribute hidden)
             },
         ]
       ~ compatibility_date  = "2025-06-30" -> "2025-05-30"
       ~ etag                = "b999c8b29ec6d607b8676a2d6e6b013547b3d8ff4b98f582db798dd66553ee4c" -> (known after apply)
       ~ has_assets          = false -> (known after apply)
       ~ has_modules         = true -> (known after apply)
         id                  = "playwright-worker"
       + migrations          = (known after apply)
       ~ modified_on         = "2025-06-30T00:51:39Z" -> (known after apply)
       ~ placement           = {
           + last_analyzed_at = (known after apply)
           + mode             = (known after apply)
           + status           = (known after apply)
         } -> (known after apply)
       ~ tail_consumers      = [] -> (known after apply)
         # (9 unchanged attributes hidden)
     }

 Plan: 0 to add, 1 to change, 0 to destroy.
 
 Do you want to perform these actions?
   Terraform will perform the actions described above.
   Only 'yes' will be accepted to approve.
cdktf-cloudflare-playwright-dev  Enter a value: yes
cdktf-cloudflare-playwright-dev  cloudflare_workers_script.PlaywrightWorker: Modifying... [id=playwright-worker]
cdktf-cloudflare-playwright-dev  ╷
 │ Error: Provider produced inconsistent result after apply
 │ 
 │ When applying changes to cloudflare_workers_script.PlaywrightWorker (PlaywrightWorker), provider
 │ "provider[\"registry.terraform.io/cloudflare/cloudflare\"]" produced an
 │ unexpected new value: .startup_time_ms: was cty.NumberIntVal(60), but now
 │ cty.NumberIntVal(77).
 │ 
 │ This is a bug in the provider, which should be reported in the provider's own
 │ issue tracker.

Steps to reproduce

Deploy a cloudflare_workers_script, then change its compatibility_date multiple times and try to deploy after every change until you get the error.

Additional factoids

No response

References

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.version/5Categorizes issue or PR as related to version 5 of the provider.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions