Skip to content

cloudflare_queue_consumer plan always forces a replacement #6486

@eperegudov

Description

@eperegudov

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.9.8
on linux_amd64
provider registry.terraform.io/cloudflare/cloudflare v5.13.0

Affected resource(s)

cloudflare_queue_consumer

Terraform configuration files

resource "cloudflare_queue_consumer" "consumer" {
  account_id  = "<account_id>"
  queue_id    = "<queue_id>"
  type        = "worker"
  script_name = "test-worker"
  settings    = {
          batch_size       = 10
          max_retries      = 3
          max_wait_time_ms = 5000
          retry_delay      = 0
  }
}

Link to debug output

https://gist.github.com/eperegudov/c3ddfef77e9290d7afff7aef3bdccbfb

Panic output

No response

Expected output

No changes planned

Actual output

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
-/+ destroy and then create replacement

Terraform will perform the following actions:

  # cloudflare_queue_consumer.consumer must be replaced
-/+ resource "cloudflare_queue_consumer" "consumer" {
      ~ consumer_id = "ed09bf087b2640debcaaff568a4e0f7a" -> (known after apply) # forces replacement
      ~ created_on  = "2025-11-24T14:58:48.567053Z" -> (known after apply)
      + script      = (known after apply)
      + script_name = "test-worker"
        # (4 unchanged attributes hidden)
    }

Plan: 1 to add, 0 to change, 1 to destroy.

Steps to reproduce

  1. Create a new Cloudflare queue and worker
  2. Plan and apply TF state
  3. Plan TF state again

Additional factoids

This unexpected behavior is probably the result of a malformed API response (service and environment fields):

{
  "result": {
    "service": "test-worker",
    "environment": "production",
    "settings": {
      "batch_size": 10,
      "max_retries": 3,
      "max_wait_time_ms": 5000,
      "retry_delay": 0
    },
    "type": "worker",
    "queue_name": "test-queue",
    "queue_id": "de2a",
    "consumer_id": "4c75",
    "created_on": "2025-11-21T17:02:26.6127Z"
  },
  "success": true,
  "errors": null,
  "messages": null
}

Current workaround is using the lifecycle block:

  lifecycle {
    ignore_changes = [
      script_name
    ]
  }

References

#5652
#6181

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