-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
add support for user project overrides #2145
add support for user project overrides #2145
Conversation
047cfbb
to
a2c5b35
Compare
Hi! I'm the modular magician, I work on Magic Modules. Pull request statusesNo diff detected in Ansible. New Pull RequestsI built this PR into one or more new PRs on other repositories, and when those are closed, this PR will also be merged and closed. |
Hi! I'm the modular magician, I work on Magic Modules. Pull request statusesterraform-provider-google-beta already has an open PR. New Pull RequestsI didn't open any new pull requests because of this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code is 👍, there's a few test cases we could add though:
-
A test of the "default" case where a user enables this behaviour with a resource inferring the project from their provider while using a service account
-
A test where the resource is using an explicit project that's different than the provider / SA project. (General working-ness is sufficient, being able to show we're using the appropriate header would be even better)
-
A test where we enable a config that couldn't have otherwise have worked. We talked about this offline briefly- I think if we make a project w/ minimal services enabled and use a service account from that project instead of our normal SA, we can test this behaviour.
4af090a
to
c70be8e
Compare
Hi! I'm the modular magician, I work on Magic Modules. Pull request statusesterraform-provider-google-beta already has an open PR. New Pull RequestsI didn't open any new pull requests because of this PR. |
c70be8e
to
0e90bd3
Compare
Hi! I'm the modular magician, I work on Magic Modules. Pull request statusesterraform-provider-google-beta already has an open PR. New Pull RequestsI didn't open any new pull requests because of this PR. |
Hi! I'm the modular magician, I work on Magic Modules. Pull request statusesterraform-provider-google-beta already has an open PR. New Pull RequestsI didn't open any new pull requests because of this PR. |
Hi! I'm the modular magician, I work on Magic Modules. Pull request statusesterraform-provider-google-beta already has an open PR. New Pull RequestsI didn't open any new pull requests because of this PR. |
I added just the one test, which is pretty comprehensive. |
ae73463
to
9997a01
Compare
9997a01
to
0c5aa37
Compare
This adds support for the userProject/X-Goog-User-Project system parameter mentioned in https://cloud.google.com/apis/docs/system-parameters. This allows users to opt-in to using resource projects for quota/billing/api checks instead of the project their credentials come from.
Doing this just in transport.go by parsing the project from the URL was an option, but since both projects and urls can contain colons (i.e. project id google.com:my-project and url https://googleapis.com/stuff/projects/my-project:setIamPolicy), I opted to pass the project through everywhere to make sure we didn't introduce bugs with parsing project names.
This change makes it easier for customers who wish to use their gcloud credentials with TF (which they might do for development for ease of IAM), since some APIs are not enabled on the gcloud project.
Also see hashicorp/terraform-provider-google#1538 for user confusion around this (it's old, but still relevant).
Also looking for feedback on the field name. I'm not a huge fan of
user_project_override
, but I don't have anything better at the moment.Release Note for Downstream PRs (will be copied)