Building the development version of Terraform

Instructions on how to build the development version of Terraform.

First you need to install Go, I have a script for this that would be easy to adapt for your needs. It installs Go, but also downloads some common projects (go-bindata, lint) and my own projects (gosnmp, evaler).

#!/bin/bash

## install go

tgz=go1.3.3.linux-amd64.tar.gz
url=https://storage.googleapis.com/golang/$tgz

if ! [ -f /var/tmp/$tgz ] ; then
	cd /var/tmp
	wget $url
fi

if ! [ -d /usr/local/go ] ; then
	sudo tar -C /usr/local -xzf /var/tmp/$tgz
fi

## setup dev directory structure

mkdir -p ~/go/{sonia,thirdparty}/{bin,pkg,src}

cd ~/go/thirdparty/src
#---------------------

read -p "Install third party repos? (go-bindata, lint)"
if [[ $REPLY =~ ^[Yy]$ ]] ; then
	if ! [ -d github.com/jteeuwen/go-bindata ] ; then
		go get github.com/jteeuwen/go-bindata/...
		cp ~/go/thirdparty/bin/go-bindata ~/bin
	fi

	if ! [ -d github.com/golang/lint ] ; then
		go get github.com/golang/lint/golint
		cp ~/go/thirdparty/bin/golint ~/bin
	fi
fi

cd ~/go/sonia/src
#----------------

read -p "Install soniah repos? (gosnmp, evaler)"
if [[ $REPLY =~ ^[Yy]$ ]] ; then
	# do 'git clone' not 'go get' so origin is writeable
	dir=github.com/soniah
	if ! [ -d $dir/evaler ] ; then
		mkdir -p $dir
		cd $dir
		git clone git@github.com:soniah/evaler.git
		cd -
	fi

	dir=github.com/soniah
	if ! [ -d $dir/gosnmp ] ; then
		mkdir -p $dir
		cd $dir
		git clone git@github.com:soniah/gosnmp.git
		cd -
	fi
fi

A common pattern in Go (which my setup script demonstrates) is to split your code from thirdparty code. This requires configuring your shell (~/.zshrc, ~/.bashrc):

export GOPATH=~/go/thirdparty:~/go/sonia                                          
export PATH=${GOPATH//://bin:}/bin:$PATH

Then you need to follow the Terraform instructions for building, that is:

$ cd ~/go/thirdparty/src
$ go get -u github.com/mitchellh/gox
$ cd ~/go/thirdparty/src/github.com/hashicorp/terraform
$ make updatedeps
$ make dev
# put the binaries somewhere in your path, eg /usr/local/bin
$ sudo cp bin/terraform* /usr/local/bin


Git and mercurial abort: revision cannot be pushed

I’ve been migrating some repositories from Mercurial to Git; as part of this migration process some users want to keep using Mercurial locally until they have time to learn git. First install the hg-git tools; for example on Ubuntu: Make sure the following is in […] more…

SaltStack Essential Reading

A list of ‘Essential Reading’ for SaltStack. A collection of useful links, mostly for myself but possibly helpful to others. How Do I Use Salt States,  States tutorial and Pillar Walkthrough – the tutorials Highstate data structure definitions and  Understanding YAML – helpful for understanding […] more…

Setup Arduino on Debian

Some notes on setting up Arduino on Debian. Add yourself to the required groups – dialout and tty. Confirm the port /dev/ttyUSB0 is being used by Arduino – tail messages then plug in the Arduino. Logout and login (or run a login shell). Confirm permissions. […] more…

Split() function for Microsoft MSSQL

Microsoft MSSQL doesn’t have a split() function (like in Ruby, Perl), so here’s one I wrote. It’s different from the other MSSQL split() functions out there on the intertubes in that it accepts a @pos parameter that specifies which split item to return – easier […] more…

MySQL SUBSTRING_INDEX function on Microsoft MSSQL

I’m porting some code from MySQL to Microsoft MSSQL, and unfortunately MSSQL doesn’t have a SUBSTRING_INDEX function. Here’s a version I quickly implemented, called “my_substring_index”. Limitations: only accepts strings up to 255 chars long only works with varchars – we speak ASCII here… more…

Microsoft SQL 2012 SSIS Create Catalog Password

Creating an SSIS Catalogue on Microsoft SQL 2012 seems to have an interface bug – you need to both “enable CLR” and provide an “encryption password”, but the options are mutually exclusive ie when I tried to type in a password, the interface locks the […] more…

Next Page »