All resources should be added do one of the region submodules under _modules
.
brew install tfenv # install terraform version manager
# install a terraform version (check your `versions.tf` file for the right version!)
tfenv install
tfenv use
terraform -v
Or go to terraform install doc page
While it can be difficult to validate terraform changes without deploying them out, the terraform validate
command can be used to catch most common syntax errors.
# downloads all needed libraries into a cache in a .terraform folder
terraform init -backend=false
terraform validate # runs the validate command
# Automatically formats all .tf files in all subdirectories
terraform fmt -recursive .
Create a bucket s3 manualy in your account to do the version control and update the terraform.tf
file with the name and region.
export AWS_ACCESS_KEY_ID=your_aws_access_key
export AWS_SECRET_ACCESS_KEY=your_aws_secret_access_key
terraform init
terraform plan -out dev.tfplan -var-file='dev.tfvars'
terraform apply -var-file='dev.tfvars'
terraform destroy -var-file='dev.tfvars'