When using Terraform 1.6 or higher with an AWS S3 backend, operations fail with a 403 Forbidden error. This occurs when traffic passes through an Edge SWG that modifies or reorders HTTP headers.
Terraform commands (e.g., terraform init, terraform plan) fail with the following error: Error: SignatureDoesNotMatch: The request signature we calculated does not match the signature you provided. Check your key and signing method.
Environment:
Terraform 1.6+ uses AWS Signature Version 4 for S3 requests. The Edge SWG may be configured to modify or reorder HTTP headers (specifically the range or content-length headers) during inspection. Since these headers are part of the signed request, any modification by the proxy after the client has signed the request results in a signature mismatch at the S3 endpoint.
To resolve this issue, modify the Edge SWG policy to ensure headers remain unmodified for traffic destined for AWS S3.