Giter Club home page Giter Club logo

packer-vagrant-box-gcs's Introduction

Packer Vagrant Box Google Cloud Storage (GCS)

GitHub latest release GoDoc Go Report Card

This is a Packer post-processor plugin to upload versioned boxes to Google Compute Storage (GCS).

Requirements

Installation

Install from release:

  • Download binaries from the releases page.
  • Install the plugin, or simply put it into the same directory with JSON templates.
  • Move the downloaded binary to ~/.packer.d/plugins/

Install from sources:

Clone repository and build

$ mkdir -p $GOPATH/src/github.com/arnaud-dezandee; cd $GOPATH/src/github.com/arnaud-dezandee
$ git clone [email protected]:arnaud-dezandee/packer-vagrant-box-gcs.git
$ cd $GOPATH/src/github.com/arnaud-dezandee/packer-vagrant-box-gcs
$ go install

Link the build to Packer

$ ln -s $GOPATH/bin/packer-vagrant-box-gcs ~/.packer.d/plugins/packer-post-processor-vagrant-box-gcs 

Usage

Add the plugin to your packer template after vagrant post-processor

{
  "builder": [{
    "type": "virtualbox-iso"
  }],
  "post-processors": [
    [
      {
        "type": "vagrant"
      },
      {
        "type": "vagrant-box-gcs",
        "box_name": "myorg/mybox",
        "bucket": "my-gcs-bucket",
        "version": "1.0.0"
      }
    ]
  ]
}

This will create two objects inside the bucket

gs://my-gcs-bucket/myorg/mybox
gs://my-gcs-bucket/myorg/boxes/mybox/1.0.0/virtualbox.box

With the help of vagrant-box-gcs plugin, you can now point your Vagrantfile to the manifest

Vagrant.configure(2) do |config|
  config.vm.box = "myorg/mybox"
  config.vm.box_url = "gs://my-gcs-bucket/myorg/mybox"
end

Authentication

Authenticating with Google Cloud services requires at most one JSON file. Packer will look for credentials in the following places, preferring the first location found:

  1. An account_file option in your packer file.

  2. A JSON file (Service Account) whose path is specified by the GOOGLE_APPLICATION_CREDENTIALS environment variable.

  3. A JSON file in a location known to the gcloud command-line tool. (gcloud auth application-default login creates it)

    On Windows, this is:

    %APPDATA%/gcloud/application_default_credentials.json
    

    On other systems:

    $HOME/.config/gcloud/application_default_credentials.json
    
  4. On Google Compute Engine and Google App Engine Managed VMs, it fetches credentials from the metadata server. (Needs a correct VM authentication scope configuration)

Configuration Reference

There are many configuration options available for the plugin. They are segmented below into two categories: required and optional parameters.

Required:

  • box_name (string) - The name of your box. (e.g. hashicorp/precise64)

  • bucket (string) - The GCS bucket name where files will be uploaded to.

  • version (string) - The version of the box you are uploading. (e.g. 1.0.0)

Optional:

  • account_file (string) - The JSON file containing your account credentials.

  • box_dir (string) - The path to a directory in your bucket to store boxes.

    Defaults to {{ box_name[org] }}/boxes/{{ box_name[title] }}/{{ version }}.

  • box_manifest (string) - The path to the manifest file in your bucket.

    Defaults to {{ box_name }}.

Related

packer-vagrant-box-gcs's People

Contributors

arnaud-dezandee avatar dependabot[bot] avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.