madelaney
madelaney
CDCloudflare Developers
Created by Isaac McFadyen on 4/10/2025 in #terraform-provider-cloudflare
Ongoing issues with R2's API at the
Oh nope, I missed that. Thanks for pointing that out. I'll just watch/follow that thread.
4 replies
CDCloudflare Developers
Created by Isaac McFadyen on 4/10/2025 in #terraform-provider-cloudflare
Ongoing issues with R2's API at the
There may be something else at play here. If the bucket doesn't exist, the terraform code creates the bucket just fine. After the bucket exists, the same terraform code, then produces the error I had first mentioned. Here is some of the output that you may find helpful:
Terraform will perform the following actions:

# module.taylow.cloudflare_r2_bucket.default will be updated in-place
~ resource "cloudflare_r2_bucket" "default" {
~ creation_date = "2025-04-10T21:39:47.845Z" -> (known after apply)
id = "testing-bucket"
+ jurisdiction = "default"
+ location = "enam"
name = "testing-bucket"
+ storage_class = "Standard"
# (1 unchanged attribute hidden)
}

Plan: 0 to add, 1 to change, 0 to destroy.
module.taylow.cloudflare_r2_bucket.default: Modifying... [id=testing-bucket]

│ Error: failed to make http request

│ with module.taylow.cloudflare_r2_bucket.default,
│ on modules/cf-public-r2/main.tf line 17, in resource "cloudflare_r2_bucket" "default":
│ 17: resource "cloudflare_r2_bucket" "default" {

│ POST "https://api.cloudflare.com/client/v4/accounts/testing-bucket/r2/buckets": 404 Not Found {"result":null,"success":false,"errors":[{"code":7003,"message":"Could not route to
│ /client/v4/accounts/testing-bucket/r2/buckets, perhaps your object identifier is invalid?"}],"messages":[]}

make: *** [apply] Error 1
Exit 2
Terraform will perform the following actions:

# module.taylow.cloudflare_r2_bucket.default will be updated in-place
~ resource "cloudflare_r2_bucket" "default" {
~ creation_date = "2025-04-10T21:39:47.845Z" -> (known after apply)
id = "testing-bucket"
+ jurisdiction = "default"
+ location = "enam"
name = "testing-bucket"
+ storage_class = "Standard"
# (1 unchanged attribute hidden)
}

Plan: 0 to add, 1 to change, 0 to destroy.
module.taylow.cloudflare_r2_bucket.default: Modifying... [id=testing-bucket]

│ Error: failed to make http request

│ with module.taylow.cloudflare_r2_bucket.default,
│ on modules/cf-public-r2/main.tf line 17, in resource "cloudflare_r2_bucket" "default":
│ 17: resource "cloudflare_r2_bucket" "default" {

│ POST "https://api.cloudflare.com/client/v4/accounts/testing-bucket/r2/buckets": 404 Not Found {"result":null,"success":false,"errors":[{"code":7003,"message":"Could not route to
│ /client/v4/accounts/testing-bucket/r2/buckets, perhaps your object identifier is invalid?"}],"messages":[]}

make: *** [apply] Error 1
Exit 2
And just to be clear, here is the TF code to create the bucket:
resource "cloudflare_r2_bucket" "default" {
account_id = var.account_id
name = var.name
location = var.location
storage_class = "Standard"
}
resource "cloudflare_r2_bucket" "default" {
account_id = var.account_id
name = var.name
location = var.location
storage_class = "Standard"
}
Same code, will create the bucket, but then run again will error out. 🤷
4 replies