Code Monkey home page Code Monkey logo

terraform-installer's Introduction

Terraform Installer - Automated Terraform Installation

Automatically Download, Extract and Install Latest or Specific Version


The terraform-install script automates the process of downloading and installing Terraform. This provides an ideal method for installation on new hosts, installing updates and even downgrading if necessary. This script detects or determines the OS and CPU-Architecture.

Options:

  • install specific version: -i VERSION
  • automatically sudo install to /usr/local/bin: -a
    • prevents user prompt asking for install destination
    • user must enter sudo password unless NOPASSWD is enabled
    • uncomment line 12 to make this the default behavior (sudoInstall=true)

Installation with this Installer

Download the installer and make executable

curl -LO https://raw.github.com/robertpeteuil/terraform-installer/master/terraform-install.sh
chmod +x terraform-install.sh

Run the installer

./terraform-install.sh

Optional Parameters

# -i = Install specific version
./terraform-install.sh -i 0.11.1

# -a = Automatic sudo install to /usr/local/bin/
./terraform-install.sh -a

Terraform's Official Installation Process

  • visit website download page
  • locate version for OS/CPU and download
  • find and extract binary from downloaded zip file
  • copy binary to a directory on the PATH

System Requirements

  • System with Bash Shell (Linux, macOS, Windows Subsystem for Linux)
  • curl
  • unzip - terraform downloads in zip format

Script Process Details

  • Determines Version to Download and Install
    • Uses Version specified by -i VERSION parameter (if specified)
    • Otherwise determines Latest Version
      • Uses GitHub API to retrieve latest version number
  • Calculates Download URL based on Version, OS and CPU-Architecture
  • Verifies URL Validity before Downloading in Case:
    • VERSION incorrectly specified with -i
    • Download URL Format Changed on terraform Website
  • Determines Install Destination
    • Performed before Download/Install Process in case User selects abort
  • Installation Process
    • Download, Extract, Install, Cleanup and Display Results

CPU Architecture Detection

CPU architecture is detected for each OS accordingly:

  • Linux / Windows (WSL since this is a Bash script)
    • detected with lscpu or by inspecting /proc/cpuinfo
  • macOS - uses Default Arch amd64 as it's the only version available on macOS
  • Default Value - amd64

License

Apache 2.0 License - Copyright (c) 2018 Robert Peteuil

terraform-installer's People

Contributors

robertpeteuil avatar drmikecrowe avatar

Watchers

 avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.