Mi Blog
Cómo instalar Terraform en GNU/Linux

Cómo instalar Terraform en GNU/Linux

 
(3 votos)

Instalar Terraform en GNU/Linux es sumamente sencillo. Terraform permite a los usuarios definir y configurar la infraestructura (IaaC) de un centro de datos en un lenguaje de alto nivel, generando un plan de ejecución para desplegar la infraestructura por ejemplo en OpenStack3, AWS, IBM Cloud, Google Cloud Platform, Microsoft Azure etc...

Seguid leyendo y os enseñaré a instalar Terraform en GNU/Linux...

⬇️ Compra en Amazon el hardware que utilizo ⬇️

🔥 ¡DESCÚBRELOS! 🔥

 

 

¿QUÉ ES TERRAFORM?

Terraform es una herramienta Open Source para aprovisionar infraestructura mediante código declarativo (IaaC). Permite automatizar y gestionar la infraestructura informática necesaria para desplegar plataformas y servicios sobre ella. Terraform también permite automatizar la gestión de estas plataformas y servicios una vez desplegados.

Al usar un código escrito con un lenguaje declarativo, no es necesario especificar los pasos o las acciones que se necesitan llevar a cabo (esto sería así en un lenguaje imperativo), sino que basta con indicar el resultado final que se quiere obtener. En este caso, el estado de la infraestructura o servicios.

Web: https://www.terraform.io/

 

 

Terraform es la navaja suiza para manejar todos los IaaC

 

 

1.- ELEMENTOS NECESARIOS PARA ESTE TUTORIAL

  • Un PC con GNU/Linux
  • Conexión a Internet (recomendado)

 

 

2.- DESCARGAR TERRAFORM PARA GNU/LINUX

Para descargar Terraform, iremos a la Web Oficial https://www.terraform.io/downloads.html y descargaremos la versión para nuestro Sistema Operativo. En este ejemplo, descargaremos la versión para GNU/Linux 64bits.

Instalar Terraform GNU/LinuxDescargar Terraform

 

 

Podemos descargar Terraform desde un navegador Web o copiar la URL de descarga y hacerlo desde consola con Wget. En este ejemplo, utilizaremos Wget para hacer la descarga:

raul@debian:~$ wget https://releases.hashicorp.com/terraform/0.15.5/terraform_0.15.5_linux_amd64.zip

 

3.- DESCOMPRIMIR TERRAFORM

Primero, crearemos un directorio donde descomprimiremos Terraform. En este ejemplo, utilizaremos y crearemos el directorio /local/terraform/:

raul@debian:~$ sudo mkdir -p /local/terraform/

 

 

Descomprimiremos Terraform en el directorio /local/terraform/ con el siguiente comando:

raul@debian:~$ sudo unzip terraform_0.15.5_linux_amd64.zip -d /local/terraform/
Archive: terraform_0.15.5_linux_amd64.zip
inflating: /local/terraform/terraform

 

 

Cargaremos la configuración con (también sirve hacer login de nuevo):

raul@debian:~$ source /etc/profile

 

 

Para que Terraform esté accesible en el PATH, podemos añadirlo de forma permanente añadiendo la siguiente línea al final del fichero /etc/profile:

export PATH=$PATH:/local/terraform/

 

 

4.- VERIFICAR QUE TERRAFORM ESTÁ INSTALADO CORRECTAMENTE

Una vez que hemos hecho todos los pasos anteriores, para verificar que Terraform está correctamente instalado, es tan sencillo como ejecutar lo siguiente:

raul@debian:~$ terraform -version
Terraform v0.15.5
on linux_amd64

 

  

Para comenzar a utilizar Terraform, podemos ejecutar lo siguiente para ver todas las opciones disponibles:

raul@debian:~$ terraform --help
Usage: terraform [global options] <subcommand> [args]

The available commands for execution are listed below.
The primary workflow commands are given first, followed by
less common or more advanced commands.

Main commands:
init Prepare your working directory for other commands
validate Check whether the configuration is valid
plan Show changes required by the current configuration
apply Create or update infrastructure
destroy Destroy previously-created infrastructure

All other commands:
console Try Terraform expressions at an interactive command prompt
fmt Reformat your configuration in the standard style
force-unlock Release a stuck lock on the current workspace
get Install or upgrade remote Terraform modules
graph Generate a Graphviz graph of the steps in an operation
import Associate existing infrastructure with a Terraform resource
login Obtain and save credentials for a remote host
logout Remove locally-stored credentials for a remote host
output Show output values from your root module
providers Show the providers required for this configuration
refresh Update the state to match remote systems
show Show the current state or a saved plan
state Advanced state management
taint Mark a resource instance as not fully functional
test Experimental support for module integration testing
untaint Remove the 'tainted' state from a resource instance
version Show the current Terraform version
workspace Workspace management

Global options (use these before the subcommand, if any):
-chdir=DIR Switch to a different working directory before executing the
given subcommand.
-help Show this help output, or the help for a specified subcommand.
-version An alias for the "version" subcommand.

 

 

ENJOY!


Acerca de Mi

RPF

Soy Ingeniero Téc. Industrial Mecánico, Administrador de Sistemas Informáticos, Desarrollador de Aplicaciones Informaticas Web, Técnico Superior en PRL, Experto en Energías Renovables... y trabajo actualmente como Senior DevOPS en HP SCDS.

Contactar conmigo

Dirección: León, España

E-Mail: Contactar

Web: https://www.raulprietofernandez.net

Skype: raul.lnx

APÚNTATE GRATIS

VIP RPF
Entra en la Comunidad VIP y consigue acceso a las descargas en PDF, Trucos y Videotutoriales ocultos y mucho más... ¡Muy Pronto!

Si haces login, serás automáticamente suscrito a mi lista de Newsletter. Siempre podrás borrarte cuando quieras.