Terraform on Debian 9

by bellis
6 deployments · 4 still active · last rev. 29 days ago

Terraform on Debian 9

Compatible with: Debian 9
						#!/bin/bash

# Start with Debian 9 on a 2gb Linode.
apt-get update && apt-get upgrade -y

# Install unzip
apt-get install unzip -y

# Install git
apt-get install git -y

# Install make
apt-get install make -y

# Install go 1.11.1
wget https://dl.google.com/go/go1.11.1.linux-amd64.tar.gz
tar -C /usr/local -xzf ./go1.11.1.linux-amd64.tar.gz
echo 'export GOPATH=/usr/local/go' >> ~/.bash_profile

#Add usr local bin to path
echo 'export PATH=$PATH:~/usr/local/bin:/usr/local/go/bin' >> ~/.bash_profile
source ./.bash_profile

# Install Terraform for 64bit Linux
wget https://releases.hashicorp.com/terraform/0.11.8/terraform_0.11.8_linux_amd64.zip
unzip ./terraform_0.11.8_linux_amd64.zip
mv ./terraform /usr/local/bin
rm terraform_0.11.8_linux_amd64.zip

# Install linode terraform provider
mkdir -p $GOPATH/src/github.com/terraform-providers
git clone https://github.com/displague/terraform-provider-linode.git $GOPATH/src/github.com/terraform-providers/terraform-provider-linode

# Install terraform examples
git clone https://github.com/displague/linode-terraform-examples.git ~/terraform

cd $GOPATH/src/github.com/terraform-providers/terraform-provider-linode && make build && cd ~

# generate ssh keys
ssh-keygen -b 4096 -f ~/.ssh/id_rsa -N ""
cp /usr/local/go/bin/terraform-provider-linode ~/terraform