-
Notifications
You must be signed in to change notification settings - Fork 756
Open
Labels
kind/bugCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.version/5Categorizes issue or PR as related to version 5 of the provider.Categorizes issue or PR as related to version 5 of the provider.
Description
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.13.4
on darwin_arm64
+ provider registry.terraform.io/cloudflare/cloudflare v5.12.0
Affected resource(s)
cloudflare_queue_consumer
Terraform configuration files
resource "cloudflare_worker" "worker" {
account_id = var.account_id
name = "worker"
}
resource "cloudflare_worker_version" "worker_version" {
account_id = var.account_id
compatibility_date = "2025-11-01"
compatibility_flags = ["nodejs_compat"]
main_module = "main.js"
modules = [
{
name = "main.js"
content_file = "${path.module}/main.js"
content_type = "application/javascript+module"
}
]
worker_id = cloudflare_worker.worker.id
}
resource "cloudflare_workers_deployment" "worker_deployment" {
account_id = var.account_id
script_name = cloudflare_worker.worker.name
strategy = "percentage"
versions = [{
percentage = 100
version_id = cloudflare_worker_version.worker_version.id
}]
}
resource "cloudflare_queue" "queue" {
account_id = var.account_id
queue_name = "queue"
}
resource "cloudflare_queue_consumer" "queue_consumer" {
account_id = var.account_id
consumer_id = cloudflare_worker.worker.id
depends_on = [cloudflare_workers_deployment.worker_deployment]
queue_id = cloudflare_queue.queue.id
script_name = cloudflare_worker.worker.name
type = "worker"
}Link to debug output
https://gist.github.com/kamronbekshodmonov/8af2d9744aaf046b01849f85703f2e9d
Panic output
│ Error: failed to make http request
│
│ with cloudflare_queue_consumer.queue_consumer,
│ on main.tf line 36, in resource "cloudflare_queue_consumer" "queue_consumer":
│ 36: resource "cloudflare_queue_consumer" "queue_consumer" {
│
│ POST "https://api.cloudflare.com/client/v4/accounts/<redacted>/queues/f85b1b7826934ccca90c67ea5f1aef3a/consumers": 400 Bad Request {
│ "result": null,
│ "success": false,
│ "errors": [
│ {
│ "code": 11004,
│ "message": "Queue 'queue' (UUID 'f85b1b7826934ccca90c67ea5f1aef3a') already has a consumer."
│ }
│ ],
│ "messages": []
│ }
Expected output
Terraform should be able to track the cloudflare_queue_consumer resource across multiple applies without errors. The existing consumer should remain in the state, and subsequent applies without changes should complete successfully without attempting to recreate the consumer or producing API errors
Actual output
Terraform successfully creates the cloudflare_queue_consumer resource the first time. On subsequent applies without any changes, Terraform cannot find the resource, and attempts to recreate it. The resource is not consistently tracked across applies, even though no configuration changes were made
│ Warning: Resource not found
│
│ with cloudflare_queue_consumer.queue_consumer,
│ on main.tf line 36, in resource "cloudflare_queue_consumer" "queue_consumer":
│ 36: resource "cloudflare_queue_consumer" "queue_consumer" {
│
│ The resource was not found on the server and will be removed from state.
│ Error: failed to make http request
│
│ with cloudflare_queue_consumer.queue_consumer,
│ on main.tf line 36, in resource "cloudflare_queue_consumer" "queue_consumer":
│ 36: resource "cloudflare_queue_consumer" "queue_consumer" {
│
│ POST "https://api.cloudflare.com/client/v4/accounts/<redacted>/queues/f85b1b7826934ccca90c67ea5f1aef3a/consumers": 400 Bad Request {
│ "result": null,
│ "success": false,
│ "errors": [
│ {
│ "code": 11004,
│ "message": "Queue 'queue' (UUID 'f85b1b7826934ccca90c67ea5f1aef3a') already has a consumer."
│ }
│ ],
│ "messages": []
│ }
Steps to reproduce
- Create main.js
- Create main.tf
- Add variables
- Run
terraform apply - Run
terraform applyagain without changing anything
Additional factoids
No response
References
No response
Metadata
Metadata
Assignees
Labels
kind/bugCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.version/5Categorizes issue or PR as related to version 5 of the provider.Categorizes issue or PR as related to version 5 of the provider.