Skip to content

Environnement Logiciel

Gestion des ressources

Info

Le logiciel devenu le standard de fait en matière d'Infrastructure-as-Code est le logiciel terraform développé par la société Hashicorp.
Suite à un changement de licence intervenu durant l'été 2023, un fork a été opéré sous la forme du projet communautaire OpenTofu soutenu par la Linux Foundation.

Documentation

Doc

Documentation de Terraform.
Documentation de OpenTofu.
Digger.

Mise-à-disposition

Ajoutons notre dépendance au logiciel terraform.

~/projet-cloud/ $ yq -i e '.dependencies["terraform.io"]="^1.6"' pkgx.yaml

Ré-activons notre environnement contextuel.
Cela va utiliser le logiciel packer depuis le cache pkgx et mettre en cache le logiciel terraform nouvellement référencé.

~/projet-cloud/ $ dev off
env -packer.io
~/projet-cloud/ $ dev on
   ~/.pkgx/terraform.io/v1.6.4
env +packer.io +terraform.io^1.6
~/projet-cloud/ $

La commande terraform est maintenant disponible dans notre environnement.

~/projet-cloud/ $ terraform
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
  metadata      Metadata related commands
  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          Execute integration tests for Terraform modules
  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.