Wil je leren hoe je een Terraform-installatie uitvoert op Ubuntu Linux? In deze tutorial laten we je zien hoe je Terraform op Linux kunt installeren.

Wat is Terraform?

Terraform is een infrastructuur-als-code-software ontwikkeld door HashiCorp en geschreven in GO-taal.

Hiermee kan een gebruiker een configuratiebestand maken dat verbinding kan maken met meerdere cloudproviders en een volledige infrastructuur kan maken of bijwerken.

Een beheerder kan bijvoorbeeld een configuratiebestand maken dat automatisch 10 virtuele machines maakt met Ubuntu Linux in Amazon AWS cloud en verbinding maakt met de Azure-cloud en een virtuele machine met Windows maakt.

Terraform Zelfstudie:

Op deze pagina bieden we snel toegang tot een lijst met tutorials gerelateerd aan Terraform.

Tutorial - Installatie Terraform

Gebruik op de Linux-console de volgende opdrachten om de vereiste software te installeren.

# apt-get update
# apt-get install wget unzip

Toegang krijgen tot Terraform downloadpagina en haal de Linux-versie compatibel met uw omgeving.

Terraform Download

We gaan het WGET-commando gebruiken om de Terraform-softwaredownload uit te voeren.

# mkdir /downloads/terraform -p
# cd /downloads/terraform
# wget https://releases.hashicorp.com/terraform/0.11.13/terraform_0.11.13_linux_amd64.zip

Nadat u de Terraform-download hebt voltooid, haalt u het Terraform-installatiepakket eruit.

# unzip terraform_0.11.13_linux_amd64.zip

Archive: terraform_0.11.13_linux_amd64.zip
inflating: terraform

Installeer de opdracht Terraform op Ubuntu met behulp van de volgende opdracht:

# install terraform /usr/local/bin/

Controleer de installatie van Terraform met behulp van de volgende opdrachten:

# terraform -version
# terraform

Je zou de volgende output moeten zien.

Usage: terraform [-version] [-help] <command> [args]

The available commands for execution are listed below.
The most common, useful commands are shown first, followed by
less common or more advanced commands. If you're just getting
started with Terraform, stick with the common commands. For the
other commands, please read the help and docs before usage.

Common commands:
apply Builds or changes infrastructure
console Interactive console for Terraform interpolations
destroy Destroy Terraform-managed infrastructure
env Workspace management
fmt Rewrites config files to canonical format
get Download and install modules for the configuration
graph Create a visual graph of Terraform resources
import Import existing infrastructure into Terraform
init Initialize a Terraform working directory
output Read an output from a state file
plan Generate and show an execution plan
providers Prints a tree of the providers used in the configuration
push Upload this Terraform module to Atlas to run
refresh Update local state file against real resources
show Inspect Terraform state or plan
taint Manually mark a resource for recreation
untaint Manually unmark a resource as tainted
validate Validates the Terraform files
version Prints the Terraform version
workspace Workspace management

All other commands:

Gefeliciteerd! Je bent in staat geweest Terraform op Ubuntu Linux te installeren.

Terraform vs Ansible

Beide zijn geweldige producten voor het maken van infrastructuur als code.

Beide producten kunnen worden gebruikt om netwerkomgevingen met complexe vereisten te implementeren.

Om een eenvoudige analogie te maken, kunnen we zeggen dat Anicius een IT-automatiseringshulpmiddel is tijdens het gebruik van Terraform, waardoor u een complete infrastructuur kunt maken met zijn infrastructuur als een code-oplossing. Dit betekent dat u een volledige netwerkomgeving kunt creëren die zich uitstrekt over meerdere cloudaanbiedingen zoals Amazon AWS, Google, Azure en anderen gebruiken een eenvoudig configuratiebestand.

Hier is een link naar een betere vergelijking tussen Terraform vs Ansible.