github.com/mohanarpit/terraform@v0.6.16-0.20160909104007-291f29853544/Vagrantfile (about)

     1  # -*- mode: ruby -*-
     2  # vi: set ft=ruby :
     3  
     4  # Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
     5  VAGRANTFILE_API_VERSION = "2"
     6  
     7  $script = <<SCRIPT
     8  GOVERSION="1.7"
     9  SRCROOT="/opt/go"
    10  SRCPATH="/opt/gopath"
    11  
    12  # Get the ARCH
    13  ARCH=`uname -m | sed 's|i686|386|' | sed 's|x86_64|amd64|'`
    14  
    15  # Install Prereq Packages
    16  sudo apt-get update
    17  sudo apt-get upgrade -y
    18  sudo apt-get install -y build-essential curl git-core libpcre3-dev mercurial pkg-config zip
    19  
    20  # Install Go
    21  cd /tmp
    22  wget --quiet https://storage.googleapis.com/golang/go${GOVERSION}.linux-${ARCH}.tar.gz
    23  tar -xvf go${GOVERSION}.linux-${ARCH}.tar.gz
    24  sudo mv go $SRCROOT
    25  sudo chmod 775 $SRCROOT
    26  sudo chown vagrant:vagrant $SRCROOT
    27  
    28  # Setup the GOPATH; even though the shared folder spec gives the working
    29  # directory the right user/group, we need to set it properly on the
    30  # parent path to allow subsequent "go get" commands to work.
    31  sudo mkdir -p $SRCPATH
    32  sudo chown -R vagrant:vagrant $SRCPATH 2>/dev/null || true
    33  # ^^ silencing errors here because we expect this to fail for the shared folder
    34  
    35  cat <<EOF >/tmp/gopath.sh
    36  export GOPATH="$SRCPATH"
    37  export GOROOT="$SRCROOT"
    38  export PATH="$SRCROOT/bin:$SRCPATH/bin:\$PATH"
    39  EOF
    40  cat <<EOF >>~/.bashrc
    41  
    42  ## After login, change to terraform directory
    43  cd /opt/gopath/src/github.com/hashicorp/terraform
    44  EOF
    45  sudo mv /tmp/gopath.sh /etc/profile.d/gopath.sh
    46  sudo chmod 0755 /etc/profile.d/gopath.sh
    47  SCRIPT
    48  
    49  Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
    50    config.vm.box = "bento/ubuntu-14.04"
    51    config.vm.hostname = "terraform"
    52  
    53    config.vm.provision "shell", inline: $script, privileged: false
    54    config.vm.synced_folder '.', '/opt/gopath/src/github.com/hashicorp/terraform'
    55  
    56    ["vmware_fusion", "vmware_workstation"].each do |p|
    57      config.vm.provider p do |v|
    58        v.vmx["memsize"] = "4096"
    59        v.vmx["numvcpus"] = "2"
    60      end
    61    end
    62  
    63    config.vm.provider "virtualbox" do |v|
    64      v.memory = 4096
    65      v.cpus = 2
    66    end
    67  
    68    config.vm.provider "parallels" do |prl|
    69      prl.memory = 4096
    70      prl.cpus = 2
    71    end
    72  end