hashicorp / terraform-provider-http

Utility provider for interacting with generic HTTP servers as part of a Terraform configuration.
https://registry.terraform.io/providers/hashicorp/http/latest
Mozilla Public License 2.0
204 stars 112 forks source link

Support resending headers on redirects #396

Open ag-TJNII opened 5 months ago

ag-TJNII commented 5 months ago

Terraform CLI and Provider Versions

registry.terraform.io/hashicorp/http 3.4.2 Terraform: 1.3.4

Use Cases or Problem Statement

We have an API we read with the Terraform Data provider that will redirect the client to a different instance if the first instance is not authoritative for the requested data. The http provider appears to follow these redirects, but does not resend all the headers specified on the second request. (No logs of this, due to #395). Not sending the Authorization header is expected default behavior. However, there are cases where it is desirable. For example cURL contains the --location-trusted flag for this case. I would like to see a similar flag in this provider.

Proposal

Add a boolean location-trusted attribute to the provider. Default should be false, and the same behavior as we have today. When true the client resends all the headers specified in the original request on redirects.

How much impact is this issue causing?

Medium

Additional Information

https://curl.se/docs/manpage.html#--location-trusted

Code of Conduct