Skip to content
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

Update provider reference docs on quota usage and always use billing_project as quota project if appropriately specified #12411

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

ScottSuarez
Copy link
Contributor

closes hashicorp/terraform-provider-google#17882

b/360405077#comment8

Release Note Template for Downstream PRs (will be copied)

See Write release notes for guidance.


@ScottSuarez
Copy link
Contributor Author

Adding comment from bug for @SarahFrench

So current behavior is we don't read quota-project from ADC at all.

First they attempt to read from an env variable.

Then they attempt to read from a 'well-known-file' aka adc.

then then fall back to GCE compute runtime credentials.

The projectId you are seeing never correlates to QuotaProjectID. This is the credential file's projectID which is still different from the quota project id. I don't know the significance of the project id here. I suspect its the project that credentials were created from.

It's worth noting that the oauth2 library does pass back the raw credential json bits which google-api library exposes an accessor of. Basically they just index into the raw credential json to see if quota project is there as a fallback.

It's also worth noting that they reference a env variable for quota project GOOGLE_CLOUD_QUOTA_PROJECT. While we reference GOOGLE_BILLING_PROJECT.

To align with googleapis library and general naming convention I would recommend we sunset billing project terminology in favor of quota_project. Also to add GOOGLE_CLOUD_QUOTA_PROJECT env in addition to GOOGLE_BILLING_PROJECT to reference docs.

I think the only thing left I didn't cover is why we don't receive this quota project if google apis library has accessor functions for it. This is because the transport library we use to create our client transport doesn't have the rawjson in the credential object available because we only pass token source for credentials and their client library doesn't read thefull object. GetQuotaProject needs the rawJSON in the credentials object to parse the quota-project from the credential file.

TLDR

google apis client library is kind of funky and the way we interact with it doesn't auto get quota project parsing from the credential file. We should probably handle it ourselves anyways. There is currently undocumented behavior of GOOGLE_CLOUD_QUOTA_PROJECT being set causing their transport layer to add the X-goog-user-project header. We should probably document this.

@ScottSuarez
Copy link
Contributor Author

@SarahFrench
Copy link
Collaborator

Just a heads up that some of the files affected by this PR have been deleted as part of the muxing fixes. Instead of parallel implementations of logic that handles credentials etc there are now only the original versions that date from when the provider was 100% SDK-implemented

@ScottSuarez
Copy link
Contributor Author

Just a heads up that some of the files affected by this PR have been deleted as part of the muxing fixes. Instead of parallel implementations of logic that handles credentials etc there are now only the original versions that date from when the provider was 100% SDK-implemented

all good :)

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 2 files changed, 16 insertions(+), 2 deletions(-))
google-beta provider: Diff ( 2 files changed, 16 insertions(+), 2 deletions(-))

Errors

google provider:

  • The diff processor failed to build. This is usually due to the downstream provider failing to compile.

google-beta provider:

  • The diff processor failed to build. This is usually due to the downstream provider failing to compile.

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 0
Passed tests: 0
Skipped tests: 0
Affected tests: 0

Click here to see the affected service packages

All service packages are affected

🔴 Errors occurred during REPLAYING mode. Please fix them to complete your PR.

View the build log

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 2 files changed, 17 insertions(+), 3 deletions(-))
google-beta provider: Diff ( 2 files changed, 17 insertions(+), 3 deletions(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 4317
Passed tests: 3908
Skipped tests: 407
Affected tests: 2

Click here to see the affected service packages

All service packages are affected

Action taken

Found 2 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccApigeeDeveloper_apigeeDeveloperUpdateTest
  • TestAccSecureSourceManagerInstance_secureSourceManagerInstancePrivatePscBackendExample

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

🟢 Tests passed during RECORDING mode:
TestAccApigeeDeveloper_apigeeDeveloperUpdateTest [Debug log]

🔴 Tests failed when rerunning REPLAYING mode:
TestAccApigeeDeveloper_apigeeDeveloperUpdateTest [Error message] [Debug log]

Tests failed due to non-determinism or randomness when the VCR replayed the response after the HTTP request was made.

Please fix these to complete your PR. If you believe these test failures to be incorrect or unrelated to your change, or if you have any questions, please raise the concern with your reviewer.


🔴 Tests failed during RECORDING mode:
TestAccSecureSourceManagerInstance_secureSourceManagerInstancePrivatePscBackendExample [Error message] [Debug log]

🔴 Errors occurred during RECORDING mode. Please fix them to complete your PR.

View the build log or the debug log for each test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"billing_project" in provider configuration ignored if GOOGLE_CLOUD_QUOTA_PROJECT environment variable is set
3 participants