-
Notifications
You must be signed in to change notification settings - Fork 9.7k
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
Support Cloudflare r2 for storing Terraform state #33847
Comments
This seems to work:
Yet if I remove
I had expected |
Thanks for this request! |
Didn't find a working solution for Terraform 1.6+ |
I am having the same problem, i also added
But now I get:
I could not find a workaround |
Terraform 1.6.x included an upgrade to the AWS SDK v2, (see the release notes), and 1.6.3 will add a feature that should help with third-party, S3-"compatible" object stores. It may be worth re-testing with 1.6.3, although I do not specifically recognize the error specified above. |
I can confirm the error mentioned above (STREAMING-UNSIGNED-PAYLOAD-TRAILER) appears with many others s3 compatible providers, such as Oracle Cloud buckets for example. |
To clarify for any future reader of this issue, AWS S3 can be used as a state file backend now. "S3-compatible" services from non-AWS vendors appear to be having trouble keeping up with compatibility, but hopefully the fixes made to the S3 backend by our AWS provider team to workaround these compatibility issues will help alleviate the issue. |
Doesn't look like the changes have stopped the issue
Version 1.6.5 |
I am also keen to see a resolution on this |
+1 for resolution |
I was able to use a Cloudflare R2 bucket as a s3 backend with terraform In order to solve the terraform {
required_providers {
cloudflare = {
source = "cloudflare/cloudflare"
version = "~> 4.0"
}
}
backend "s3" {
bucket = "terraform-state"
key = "project_name/terraform.tfstate"
endpoints = { s3 = "https://xxxxx.r2.cloudflarestorage.com" }
region = "us-east-1"
access_key = "xxxx"
secret_key = "xxxxx"
skip_credentials_validation = true
skip_region_validation = true
skip_requesting_account_id = true
skip_metadata_api_check = true
skip_s3_checksum = true
}
} |
reference: #34127 |
Thanks! that has worked for me on v1.6.5. I have been able to init, plan and apply. |
Works for me too. Would have thought skip_region_validation would mean we wouldn’t need the us-east entry though, so still potentially a bug that could confuse people? Or is that doing something different? |
[terraform version 1.6.6]
It's returning this as an error during the
|
|
@missinglink It's not an issue with using the values from environment variables, it is successfuly authenticating to the S3 API. |
Fixed my issue. I misunderstood what the |
I am under the impression that as of the 1.6.6 release, the original issue scenario now is supported or have work-arounds. Is anyone still experiencing the original issue as described? If not I'll close this issue. Thanks! |
@crw it certainly doesn't work 'out of the box' as there is significant configuration required. Once this issue is closed where will the knowledge gained in this thread live? |
Good question. I doubt we would document the nuances of configuration for every 3rd party S3-compatible vendor on the primary S3 backend page. Is there any existing documentation on this on the Cloudflare side? A quick google search turns up this user-editable page: https://developers.cloudflare.com/r2/examples/terraform/ -- my gut feeling is that this would be the best place for this documentation. |
Following confirmed to work on Terraform backend "s3" {
bucket = "whatever"
key = "key/goes/here/terraform.tfstate"
region = "auto"
skip_credentials_validation = true
skip_metadata_api_check = true
skip_region_validation = true
skip_requesting_account_id = true
skip_s3_checksum = true
use_path_style = true
# endpoint = AWS_ENDPOINT_URL_S3
/*
ENVIRONMENT VARIABLES
---------------------
AWS_ACCESS_KEY_ID - R2 token
AWS_SECRET_ACCESS_KEY - R2 secret
AWS_ENDPOINT_URL_S3 - R2 location: https://ACCOUNT_ID.r2.cloudflarestorage.com
*/
} |
You're missing state lock here, correct? Is there a way to enable r2 to support state locking? |
Closing this issue as it appears to be resolved. For future viewers, the suggested path forward is to edit the page mentioned in #33847 (comment), possibly using the information provided in #33847 (comment). From my quick examination, it looks like that page has not yet been updated. Thanks! |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Terraform Version
Use Cases
Cloudflare r2 storage is S3 API compatible, but the
s3
backend for storing Terraform state seems to be only compatible with Amazon AWS.https://developers.cloudflare.com/r2/api/s3/api/
Attempted Solutions
Tried using the S3 but it's not compatible. Thought changing the
endpoint
would do it, but the region field is compulsory. When adding in a random region it fails to authenticate with the Cloudflare endpoint.Proposal
No response
References
No response
The text was updated successfully, but these errors were encountered: