Documentation on Google Cloud SDK https://cloud.google.com/sdk/docs/ directs one to run gcloud init after installing it.
Is there a way to automate this step given that gcloud init is an interactive command?
Documentation on Google Cloud SDK https://cloud.google.com/sdk/docs/ directs one to run gcloud init after installing it.
Is there a way to automate this step given that gcloud init is an interactive command?
One does not need to run gcloud init. Main goal is to make sure credentials are configured and perhaps the project property is set. If you have service-account credentials, gcloud can be configured and ready to go via the following:
gcloud auth activate-service-account --key-file=credential_key.json
gcloud config set project my-project
For completeness gcloud init essentially runs the following steps:
gcloud config configurations create my_configurationgcloud config configurations activate my_configurationgcloud auth logingcloud config set account my_existing_credentialsgcloud auth activate-service-accountgcloud config set project my_project
gcloud projects listgcloud config set compute/zone my_default_gce_zone
gcloud compute zones listgcloud config set compute/region my_default_gce_region
gcloud compute regions listgsutil config -n -o ~/.boto