gcloud: Use GCE_PROJECT for project always, if specified #750
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently if
GCE_SERVICE_ACCOUNT_FILE
is set,GCE_PROJECT
is ignored. This PR changes the behavior to useGCE_PROJECT
for the project in all cases, if it is set.I believe in practice the most common scenario is that a provided service account file does not specify a project, which is the default when generating a service account key via gcloud CLI or web console. So this change helps avoid forcing users to add a project ID to their service account file by simply specifying
GCE_PROJECT
as I think a user would expect.This change also allows a user to override a project id in a service account file, which is probably a less common scenario but is the use case described in #604.
To use the project ID from a service account file, the user simply specifies
GCE_SERVICE_ACCOUNT_FILE
and notGCE_PROJECT
. The new behavior seems most intuitive.Fixes #604