https://cloud.google.com/apis/docs/system-parameters
This should resolve some issues with gcloud-based interactive user credentials.
Would it be simple to add this to resources that aren't auto-generated by magic-modules?
For context; we're being bitten by this when using the google_container_cluster resource, which doesn't respect the user_project_override attribute on the provider.
It wouldn't be simple to do it for all of them in a big sweeping change, but on an individual basis, yup it would be pretty easy. Most of the client libraries we use have a Header() function that can be used to add headers to the request before it's sent out. Are you asking because you'd like to contribute that change, or because you'd like someone on our team to do so?
I would be up for making the changes myself. I had a quick look at the generated API client for the container service yesterday, so I will take another look today and see if I can find a path. Should we be setting X-Goog-User-Project irrespective of the setting for user_project_override?
Cool! I actually just did a combination generated and handwritten one at https://github.com/GoogleCloudPlatform/magic-modules/pull/2737, so you can take a look at how I did it there. Since using project overrides requires specific IAM permissions, it's best if we continue making it opt-in using the user_project_override setting.
Closing as it's not looking like we're going to move forward with this, due to the IAM permissions issue.
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.
If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!