terraform-switcher

command module
v0.0.0-...-d4385dd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 8, 2019 License: MIT Imports: 8 Imported by: 0

README

Build Status Go Report Card CircleCI

Terraform Switcher

drawing

The tfswitch command line tool lets you switch between different versions of terraform. If you do not have a particular version of terraform installed, tfswitch will download the version you desire. The installation is minimal and easy. Once installed, simply select the version you require from the dropdown and start using terraform.

See installation guide here: tfswitch installation

Installation

tfswitch is available for MacOS and Linux based operating systems.

Homebrew

Installation for MacOS is the easiest with Homebrew. If you do not have homebrew installed, click here.

brew install warrensbox/tap/tfswitch
Linux

Installation for other linux operation systems.

curl -L https://raw.githubusercontent.com/warrensbox/terraform-switcher/release/install.sh | bash
Install from source

Alternatively, you can install the binary from source here

How to use:

Use dropdown menu to select version
drawing
  1. You can switch between different versions of terraform by typing the command tfswitch on your terminal.
  2. Select the version of terraform you require by using the up and down arrow.
  3. Hit Enter to select the desired version.

The most recently selected versions are presented at the top of the dropdown.

Supply version on command line
drawing
  1. You can also supply the desired version as an argument on the command line.
  2. For example, tfswitch 0.10.5 for version 0.10.5 of terraform.
  3. Hit Enter to switch.
Use .tfswitchrc file
  1. Create a .tfswitchrc file containing the desired version
  2. For example, echo "0.10.5" >> .tfswitchrc for version 0.10.5 of terraform
  3. Run the command tfswitch in the same directory as your .tfswitchrc

Automatically switch with bash

Add the following to the end of your ~/.bashrc file:

cdtfswitch(){
  builtin cd "$@";
  cdir=$PWD;
  if [ -f "$cdir/.tfswitchrc" ]; then
    tfswitch
  fi
}
alias cd='cdtfswitch'

Automatically switch with zsh

Add the following to the end of your ~/.zshrc file:

load-tfswitch() {
  local tfswitchrc_path=".tfswitchrc"

  if [ -f "$tfswitchrc_path" ]; then
    tfswitch
  fi
}
add-zsh-hook chpwd load-tfswitch
load-tfswitch

older version of zsh

cd(){
  builtin cd "$@";
  cdir=$PWD;
  if [ -f "$cdir/.tfswitchrc" ]; then
    tfswitch
  fi
}

Additional Info

See how to upgrade, uninstall, troubleshoot here:More info

Issues

Please open issues here: New Issue

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL