Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: set header for quota project when possible
This commit partially addresses #9454, in the case when the provider is configured with both the user_project_override AND billing_project setting, by setting a header in the LoadAndValidate function stage on the HTTP client used by all handwritten resources. Originally this commit used a Google API client ClientOption [1], but unfortunately headers set by the Google API client's transport implementation [2] aren't visible by the logging transport [3]. I thought it would be better to include the header at a higher level in order to aid with debugging in the future. If [4] is ever merged, moving the logging transport _inside_ of the API client and switching to a ClientOption for the header would probably be a better way. Finally, this does not address having user_project_override set to true without the billing_project setting, as that would require more logic to determine which project the resource is referring to. [1] https://pkg.go.dev/google.golang.org/api/option#WithQuotaProject [2] https://github.com/googleapis/google-api-go-client/blob/3e2b6a25f224e301409d11443d464af92671d2f0/transport/http/dial.go#L86-L88 [3] https://github.com/hashicorp/terraform-provider-google/blob/0e315b07d9ed37bd884a1060c22681908d23f270/google/config.go#L373-L374 [4] googleapis/google-cloud-go#1962
- Loading branch information