-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
Terraform 1.6.x - SignatureDoesNotMatch Error - S3 Backend (GetObject) #34136
Comments
I believe I may be encountering a similar issue
I am listing objects in a bucket and then getting details about each:
The
I've researched other causes of this problem like clock sync and credentials issues. I've ruled those out because all my other requests succeed. I have other prefixes that have similar files in them. The requests also fail on the Is it possible there is a bug in the signature generation? |
Thanks for replying @josh-keller - I’ve still not found a solution after countless hours troubleshooting. I just updated my initial comment to mention that the exact same configuration works perfectly with previous versions 1.3.1 and 1.5.3, so it seems this could either be a bug or some behavioural change based off the same configuration with 1.6.x. |
@lambbuster I have tried on 1.3.1 and 1.5.3 and it doesn't seem to work. Wondering if this could be in the AWS provider. What version of that are you using with those earlier versions of Terraform? |
Actually, I have narrowed this down. My request works with |
I see in the |
@josh-keller - for the older TF versions (1.3.1/1.5.3) we had the constraint set to use the latest version 4 release (~> 4.0), so 4.67.0. I’ve just tried using 1.6.0 (and 1.6.3!) with 5.16.2 of the AWS provider and still get the same error :( Thanks for helping with the troubleshooting! |
Interesting, maybe it's not the Go SDK v2. Or maybe there are two different issues going on. Anyway, I have a version that works for me at the moment and need to move forward with that for now. |
We have performed verification with #34243 and fix mentioning this Issue does not resolve it. This issue is caused by PRs #33669 #33843 - which is switch from s3 client to s3 transfer manager. As s3 transfer manager is using HTTP range header and also includes it in AWS SigV4 generation so when proxy drop this header, AWS cannot correctly verify signature In above samples we can see Issue will occur for everyone that uses proxy that does not support HTTP Header "Range" Reference: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Range Proxies can have 3 behaviors: This change was not part of 1.6.0-beta1 which still worked correctly with proxies not supporting range. There are couple of options how we can approach this problem: |
@Echeoss |
Hi. We switched for testing to local tfstate file. On remote execution we do not have proxy so issue does not exists. |
Terraform Version
Terraform Configuration Files
Debug Output
Expected Behavior
Terraform should be able to refresh the state and initialise properly.
Actual Behavior
Terraform attempts to refresh the state (GetObject) and a SignatureDoesNotMatch error is thrown.
Steps to Reproduce
Additional Context
Terraform 1.6.0 is not able to refresh an existing state file after first run for a new state held in an s3 backend.
The first run is able to perform the ListBucketsV2, HeadObject and PutObject operations to init and apply. On subsequent runs, the ListBucketsV2 and HeadObject operations are successful, but the GetObject operation fails (HeadObject returns that an object with the key name is present) with a SignatureDoesNotMatch error.
This behaviour is only observed when running Terraform locally. When the same execution is made via a jenkins pipeline, no issue occurs. The only difference between the two is that our jenkins pipeline gets session credentials via an assume-role CLI call and exports them to environment variables, whereas locally we are using a federated AD role to gain session credentials.
I have tried numerous configurations for the s3 backend:
My only summary is that the signature for the GetObject request is not being created properly. From debug logs i can see the session credentials are received correctly whichever way I configure the backend, so I don't believe the issue is in this area. It's just that GetObject call that Terraform doesn't like!
NOTE: The exact same configuration works perfectly if I switch back to either version 1.3.1 or 1.5.3 (these are the only other pre-1.6.x versions available to us).
Any help would be greatly appreciated.
References
No response
The text was updated successfully, but these errors were encountered: