This is a Vagrant 2.2.0+ plugin that adds the ability to download boxes from Google Compute Storage (GCS).
$ vagrant plugin install vagrant-box-gcsOnly the gs:// protocol shorthand is supported
The plugin supports fetching compatible manifest file of versioned boxes repository. See packer-vagrant-box-gcs to create one.
$ vagrant box add gs://my-bucket/my-org/my-box-manifest.jsonThe box update command line is available when using manifest
$ vagrant box update --box my-org/my-box# Vagrantfile
Vagrant.configure('2') do |config|
config.vm.box = 'my-org/my-box'
config.vm.box_url = 'gs://my-bucket/my-org/my-box-manifest.json'
end$ vagrant box add gs://my-bucket/my-org/my-box/virtualbox.box# Vagrantfile
Vagrant.configure('2') do |config|
config.vm.box_url = 'gs://my-bucket/my-org/my-box/virtualbox.box'
endAuthenticating with Google Cloud services requires at most one JSON file. Vagrant will look for credentials in the following places, preferring the first location found:
-
A JSON file (Service Account) whose path is specified by the
GOOGLE_APPLICATION_CREDENTIALSenvironment variable. -
A JSON file in a location known to the
gcloudcommand-line tool. (gcloud auth application-default logincreates it)On Windows, this is:
%APPDATA%/gcloud/application_default_credentials.jsonOn other systems:
$HOME/.config/gcloud/application_default_credentials.json -
On Google Compute Engine and Google App Engine Managed VMs, it fetches credentials from the metadata server. (Needs a correct VM authentication scope configuration)
Auto-install with some shell in your Vagrantfile:
# Vagrantfile
unless Vagrant.has_plugin?('vagrant-box-gcs')
system('vagrant plugin install vagrant-box-gcs') || exit!
exit system('vagrant', *ARGV)
end
Vagrant.configure('2') do |config|
config.vm.box_url = 'gs://my-bucket/my-org/my-box/virtualbox.box'
# ...
end- packer-vagrant-box-gcs - Packer plugin to upload Vagrant boxes to Google GCS.