Get the 1&1 Terraform Plug-In

Table of Contents

Getting Started

Before you begin you will need to have signed up for a 1&1 account. The credentials you create during sign-up will be used to authenticate against the API.

Introduction

This is a plug-in for Terraform. Terraform enables you to safely and predictably create, change, and improve production infrastructure. It is an open source tool that codifies APIs into declarative configuration files that can be shared amongst team members, treated as code, edited, reviewed, and versioned.

Install Terraform

Terraform must first be installed on the machine where you plan to run it. Terraform is distributed as a binary package for various platforms and architectures.

To install Terraform, download the appropriate package for your system. Terraform is packaged as a zip archive.

After downloading, unzip the package into a directory where Terraform will be installed. (Example: ~/terraform or c:\terraform)

Add the Terraform Directory to the PATH

Note: The adjustments to the PATH environment variable as outlined below are temporary. There are numerous examples available on the internet describing how to make permanent changes to environment variables for each particular operating system.

If you prefer not to change the PATH, you can invoke Terraform directly by going to the directory and using the command ./terraform, or from anywhere using the full path such as ./home/jdoe/terraform.

To add the Terraform directory to your PATH:

Linux

If you plan to run Terraform in a shell on Linux and placed the binary in the /home/[username]/terraform/ directory, you would use the command:

PATH=$PATH:/home/[username]/terraform

Mac OSX

If you plan to run Terraform in a shell on a Mac and placed the binary in the /Users/[username]/terraform/ directory, you would use the command:

PATH=$PATH:/Users/[YOUR-USER-NAME]/terraform

Windows

If you plan to run terraform.exe in PowerShell on Windows and placed the binary in c:\terraform directory, you would first find the existing value of PATH:

echo $env:Path

If it ends with a ;, then run:

$env:Path += "c:\terraform"

If it does NOT end with a ;, then run:

$env:Path += ";c:\terraform"

Verify the Terraform Installation

After installing Terraform, verify the installation by executing terraform or terraform.exe. You should see the default "usage" output similar to this:

$ terraform
usage: terraform [--version] [--help] <command> [<args>]

Available commands are:
    apply       Builds or changes infrastructure
    destroy     Destroy Terraform-managed infrastructure
    get         Download and install modules for the configuration
    graph       Create a visual graph of Terraform resources
    init        Initializes Terraform configuration from a module
    output      Read an output from a state file
    plan        Generate and show an execution plan
    push        Upload this Terraform module to Atlas to run
    refresh     Update local state file against real resources
    remote      Configure remote state storage
    show        Inspect Terraform state or plan
    taint       Manually mark a resource for recreation
    validate    Validates the Terraform files
    version     Prints the Terraform version

Install the Plug-In

Download the desired release archive from the 1&1 Terraform Provider Releases. Extract the binary from the archive and place it in the same location you used for the Terraform binary in the previous step. It should have the name terraform-provider-oneandone or terraform-provider-oneandone.exe.

Build the Plug-In from Source

The build process requires that the GO language be installed and configured on your system.

Once you have GO installed and working, then retrieve the Terraform 1&1 provider source code using the following command:

go get github.com/1and1/terraform-provider-oneandone

Then change to the project directory and run make install:

cd $GOPATH/github.com/1and1/terraform-provider-oneandone

make install

The resulting binary can be copied to the same directory you installed Terraform in.

Comments

It seems that the repo for the Terraform-Plugin (see the provided link) doesn't contain any binary ... ???

Tags: Terraform