Skip to content

cloudflare_r2_bucket location hint can always force replacement #6458

@josefguenther

Description

@josefguenther

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

cloudflare/cloudflare v5.12.0

Affected resource(s)

n/a

Terraform configuration files

resource "cloudflare_r2_bucket" "my_bucket" {
  account_id = var.account_id
  name       = "my_bucket"
  location   = "ENAM" # Eastern North America
}

Link to debug output

n/a

Panic output

No response

Expected output

No updates.

Location hint not matching the bucket location should NOT trigger update; it is well documented that this may occur in various scenarios.

Actual output

Terraform will perform the following actions:

module.cloudflare.cloudflare_r2_bucket.assets must be replaced
-/+ resource "cloudflare_r2_bucket" "my_bucket" {
~ creation_date = "2025-11-12T20:12:55.794Z" -> (known after apply)
~ id = "my_bucket" -> (known after apply)
~ location = "WNAM" -> "ENAM" # forces replacement
name = "my_bucket"
# (3 unchanged attributes hidden)
}

Steps to reproduce

  1. Create a bucket in a specific location (eg WNAM).
  2. Update the bucket location. This forces replacement.
  3. Observe that the bucket will be replaced, but Cloudflare keeps the original location. This is documented behavior.
  4. Every time you try to update your stack, it will try to replace the bucket.

Additional factoids

Docs: "Location Hints are only honored the first time a bucket with a given name is created. If you delete and recreate a bucket with the same name, the original bucket’s location will be used."
Docs: "Keep in mind Location Hints are a best effort and not a guarantee."

See documentation.

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