Reputation: 60574
I'm trying to configure properties for the Google Cloud SDK in a non-interactive environment (specifically, a Docker container), and I'd like to use environment variables to do it (because it seems much simpler to get right and portable compared to volume-mounting config files...). However, I can't find any documentation on what the environment variables should be called, etc.
Is it possible to configure the Google Cloud SDK using environment variables, and how do I do so?
Clarification: For now, the only property I care about is the default project, core/project
in this listing.
Upvotes: 2
Views: 3451
Reputation: 1291
According to the official docs:
You can also set properties using environment variables. Each property has a corresponding environment variable that can be used to set it. The name of the environment variable follows the CLOUDSDK_SECTION_NAME_PROPERTY_NAME pattern. For example, you can set the core/project and compute/zone properties as follows:
CLOUDSDK_CORE_PROJECT=PROJECT_NAME CLOUDSDK_COMPUTE_ZONE=ZONE_NAME
I tried to update the accepted answer but wasn't allowed to.
Upvotes: 1
Reputation: 40091
There is a set of environment variables (CLOUDSDK_
) that match some (all?) of the gcloud config properties.
I was unable to find these documented but I'm aware of them through the kubectl Cloud Builder (see here) and this post
I've submitted an issue asking Google to document these (more clearly).
Upvotes: 6