Skip to content

Oscaner/terraform-best-practices

Repository files navigation

Preparation

  1. nvm
  2. terraform

MacOS

# nvm, terraform
brew install nvm terraform tflint

Ubuntu

# nvm
curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
source ~/.bashrc

# terraform: https://askubuntu.com/a/1158357
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
sudo apt-add-repository "deb [arch=$(dpkg --print-architecture)] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
sudo apt update
sudo apt install terraform

# tflint: https://github.com/terraform-linters/tflint
curl -s https://raw.githubusercontent.com/terraform-linters/tflint/master/install_linux.sh | bash

Init project

nvm use
npm install
terraform -chdir=src init
tflint -chdir=src --init

terraform -chdir=src validate
tflint -chdir=src