Terraform on Centos

Terraform

Log into the Centos VM as your normal user:

  • mkdir ~/terraform
  • cd ~/terraform
  • unzip /media/sf_Downloads/terraform_0.11.10_linux_amd64.zip
  • echo “PATH=$PATH:~/terraform” >> ~/.bashrc

At this point you should decide where you will be saving your AWS keys (we will get them a little later) for now we will set up some terraform alias commands to make life a little easier.

Edit .bashrc and add the alias commands at the end.

  • cd ~
  • vi .bashrc

# use down arrows to go to the end of the file and enter the following

PATH=$PATH:$HOME/.local/bin:$HOME/bin
export PATH

eval "$(chef shell-init bash)"
export PATH="/opt/chefdk/embedded/bin:$PATH:~/DEVOPS/graphviz-2.38/release"

alias tfi='terraform init -var-file="/.auto.tfvars"'
alias tfp='terraform plan -var-file="/.auto.tfvars"'
alias tfa='terraform apply -var-file="/.auto.tfvars"'
alias tfd='terraform destroy -var-file="/.tfvars"'
alias tfg='terraform graph | dot -Tsvg > graph.svg'
alias tfo='terraform output'
alias cdtf='cd ~/sf_DEVOPS/Terraform/'
alias cdto='cd ~/sf_DEVOPS/Terraform/AWS-Terraform-DB-and-Modules/OracleForASM/'
alias cdgit='cd ~/sf_DEVOPS/GitHub/'
alias cdc='cd ~/chef-repo'
alias rstf='rsync -va /media/sf_DEVOPS/Terraform ~/sf_DEVOPS/'
alias rsall='rsync -va /media/sf_DEVOPS ~'

export TERM=xterm-mono
export PATH="/opt/chef/embedded/bin:$PATH"

Download a git repository

cd ~
# If not already done then setup git
mkdir ~/git cd git git init
# Create a directory for the first set of terraform scripts
mkdir AWS-RDS-PostgreSQL
# move to the directory
cd AWS-RDS-PostgreSQL
# get the terraform scripts from git
wget https://github.com/paulhhallam/AWS-RDS-PostgreSQL.git