Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue changing location from ENAM to WEUR in a r2 bucket #3311

Open
3 tasks done
marccortinas opened this issue May 16, 2024 · 3 comments
Open
3 tasks done

Issue changing location from ENAM to WEUR in a r2 bucket #3311

marccortinas opened this issue May 16, 2024 · 3 comments
Labels
kind/bug Categorizes issue or PR as related to a bug. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. triage/debug-log-attached Indicates an issue or PR has a complete Terraform debug log.

Comments

@marccortinas
Copy link

marccortinas commented May 16, 2024

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 version: 1.5.2
v4.30.0

Affected resource(s)

  • resource "cloudflare_r2_bucket"

Terraform configuration files

resource "cloudflare_r2_bucket" "static" {
  account_id       = local.cloudflare_account_id
  name       = "static"
  location   = "WEUR"
}

Link to debug output

https://gist.github.com/marccortinas/d96bdfc0573929acf2ba7fbfcfaefd4c

Panic output

│ Error: Provider produced inconsistent result after apply
│
│ When applying changes to cloudflare_r2_bucket.statics, provider "provider[\"registry.terraform.io/cloudflare/cloudflare\"]"
│ produced an unexpected new value: .location: was cty.StringVal("WEUR"), but now cty.StringVal("ENAM").
│
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
╵

Expected output

Terraform will perform the following actions:

  # cloudflare_r2_bucket.statics is tainted, so must be replaced
-/+ resource "cloudflare_r2_bucket" "statics" {
      ~ id         = "statics" -> (known after apply)
      ~ location   = "ENAM" -> "WEUR"
        name       = "statics"
        # (1 unchanged attribute hidden)
    }

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

Actual output


│ Error: Provider produced inconsistent result after apply
│
│ When applying changes to cloudflare_r2_bucket.statics, provider "provider[\"registry.terraform.io/cloudflare/cloudflare\"]"
│ produced an unexpected new value: .location: was cty.StringVal("WEUR"), but now cty.StringVal("ENAM").
│
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
╵

Steps to reproduce

  1. R2 bucket created in ENAM region
  2. The same R2 bucket change the location to WEUR

Additional factoids

Finally i modified the name of the bucket. The first bucket was called statics and the current one is called static and it's working fine

References

https://developers.cloudflare.com/r2/reference/data-location/
https://registry.terraform.io/providers/cloudflare/cloudflare/latest/docs/resources/r2_bucket

@marccortinas marccortinas added kind/bug Categorizes issue or PR as related to a bug. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels May 16, 2024
Copy link
Contributor

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@github-actions github-actions bot added the triage/debug-log-attached Indicates an issue or PR has a complete Terraform debug log. label May 16, 2024
@jacobbednarz
Copy link
Member

once a bucket is created, you cannot change the location of the bucket. we should probably do a ForceNew: true here to prevent this scenario.

@Cyb3r-Jak3
Copy link
Contributor

Following up, per the 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.

A solution might be to check is the location hint has changed without the bucket name changing and throw an error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. triage/debug-log-attached Indicates an issue or PR has a complete Terraform debug log.
Projects
None yet
Development

No branches or pull requests

3 participants