terraform-provider-cloudflare icon indicating copy to clipboard operation
terraform-provider-cloudflare copied to clipboard

`cloudflare_r2_bucket` produced an unexpected new value

Open Ramblurr opened this issue 1 year ago • 5 comments

Confirmation

  • [X] My issue isn't already found on the issue tracker.
  • [X] I have replicated my issue using the latest version of the provider and it is still present.

Terraform and Cloudflare provider version

Terraform v1.7.1-dev on linux_amd64

  • provider registry.terraform.io/1password/onepassword v1.4.1
  • provider registry.terraform.io/aminueza/minio v2.0.1
  • provider registry.terraform.io/carlpett/sops v1.0.0
  • provider registry.terraform.io/cloudflare/cloudflare v4.24.0
  • provider registry.terraform.io/hashicorp/random v3.6.0

Affected resource(s)

cloudflare_r2_bucket

Terraform configuration files

resource "cloudflare_r2_bucket" "main" {
  account_id = var.cloudflare_account_id
  name       = var.bucket_name
  location   = "weur"
}

Link to debug output

https://gist.github.com/Ramblurr/cc599be39f51eb532e88fd72627f886b

Panic output

No response

Expected output

It should not fail with This is a bug in the provider, which should be reported in the provider's own issue tracker.

Actual output

The first time I ran this I got:

│ Error: failed to create R2 bucket
│ 
│   with module.volsync_bucket["volsync-calibre"].module.r2_bucket[0].cloudflare_r2_bucket.main,
│   on modules/r2-bucket/main.tf line 1, in resource "cloudflare_r2_bucket" "main":
│    1: resource "cloudflare_r2_bucket" "main" {
│ 
│ Please enable R2 through the Cloudflare Dashboard. (10042)

Then I enabled R2 in the account via the Dashboard.

Then I ran the terraform again:

module.volsync_bucket["volsync-calibre"].module.r2_bucket[0].cloudflare_r2_bucket.main: Creating...
╷
│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to module.volsync_bucket["volsync-calibre-web"].module.r2_bucket[0].cloudflare_r2_bucket.main, provider "provider[\"registry.terraform.io/cloudflare/cloudflare\"]" produced an unexpected new value:
│ .location: was cty.StringVal("weur"), but now cty.StringVal("WEUR").
│ 
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.

Steps to reproduce

  1. try to create a bucket (with a location hint set) without R2 enabled on the account
  2. after failure, enable R2 on the account
  3. try to create the bucket again

Additional factoids

No response

References

No response

Ramblurr avatar Feb 20 '24 13:02 Ramblurr

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[bot] avatar Feb 20 '24 13:02 github-actions[bot]

The issue either connected to location property or it being weur, since when I commented it out the issue was gone

savelichalex avatar Feb 27 '24 11:02 savelichalex

Looks like a case sensitivity issue; setting location to WEUR — not weur —  solves the inconsistency

sbaildon avatar Mar 01 '24 17:03 sbaildon

In the error you can see it show the value in lower and uppercase.

But to be clear I never wrote it upper case. And I didn't change the terraform between steps 1 and 3.

Ramblurr avatar Mar 02 '24 08:03 Ramblurr

In the error you can see it show the value in lower and uppercase.

But to be clear I never wrote it upper case. And I didn't change the terraform between steps 1 and 3.

Yeah — documentation says to use weur in your manifests, but the the provider uses WEUR internally, with case-sensitive matching. Using WEUR in your manifest will sidestep the issue for now

sbaildon avatar Mar 02 '24 13:03 sbaildon

This functionality has been released in v4.37.0 of the Terraform Cloudflare Provider.

Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

github-actions[bot] avatar Jul 11 '24 01:07 github-actions[bot]