Catalogue des Commandes 03/04/2026 21:00:00 angularforall.com

- Commandes Terraform : guide complet CLI IaC

Terraform Iac Cli Commandes Devops Infrastructure Infrastructure-As-Code Hashicorp Providers Modules-Terraform Tfstate Aws Gcp Azure

Référence complète des commandes Terraform : init, plan, apply, destroy, workspace, state, import et providers pour automatiser votre infrastructure cloud.

terraform init
Description :

Initialise le répertoire de travail Terraform

Options :
  • -backend=false
  • -backend-config=path
  • -force-copy ⚠️
  • -from-module=source ⚠️
  • -get=false
  • -get-plugins=false
  • -input=false
  • -lock=false
  • -lock-timeout=0s
  • -migrate-state
  • -no-color
  • -plugin-dir=path
  • -reconfigure ⚠️
  • -upgrade
terraform plan
Description :

Prévisualise les changements à appliquer

Options :
  • -compact-warnings
  • -destroy
  • -detailed-exitcode
  • -generate-config-out=path
  • -input=false
  • -lock=false
  • -lock-timeout=0s
  • -no-color
  • -out=path
  • -parallelism=n
  • -refresh=false ⚠️
  • -refresh-only ⚠️
  • -replace=resource ⚠️
  • -target=resource
  • -var=foo=bar
  • -var-file=foo.tfvars ⚠️
terraform apply
Description :

Applique les changements pour atteindre l'état désiré

Options :
  • -auto-approve
  • -backup=path
  • -compact-warnings
  • -destroy
  • -input=false
  • -lock=false
  • -lock-timeout=0s
  • -no-color
  • -parallelism=n
  • -refresh=false ⚠️
  • -refresh-only ⚠️
  • -replace=resource ⚠️
  • -state=path
  • -state-out=path
  • -target=resource
  • -var=foo=bar
  • -var-file=foo.tfvars ⚠️
terraform destroy
Description :

Détruit toute l'infrastructure gérée par Terraform

Options :
  • -auto-approve
  • -backup=path
  • -compact-warnings
  • -input=false
  • -lock=false
  • -lock-timeout=0s
  • -no-color
  • -parallelism=n
  • -refresh=false ⚠️
  • -state=path
  • -state-out=path
  • -target=resource
  • -var=foo=bar
  • -var-file=foo.tfvars ⚠️
terraform validate
Description :

Valide les fichiers de configuration Terraform

Options :
  • -json
  • -no-color
terraform fmt
Description :

Formate les fichiers .tf selon le style canonique

Options :
  • -check
  • -diff
  • -list=false
  • -no-color
  • -recursive ⚠️
  • -write=false
terraform output
Description :

Affiche les valeurs des outputs du state

Options :
  • -json
  • -no-color
  • -raw ⚠️
  • -state=path
terraform show
Description :

Affiche le state ou le plan en format lisible

Options :
  • -json
  • -no-color
terraform state list
Description :

Liste les ressources dans le state Terraform

Options :
  • -id=ID
  • -state=path
terraform state show
Description :

Affiche les attributs d'une ressource du state

Options :
  • -no-color
  • -state=path
terraform state mv
Description :

Déplace une ressource dans le state

Options :
  • -backup=path
  • -backup-out=path
  • -dry-run ⚠️
  • -lock=false
  • -lock-timeout=0s
  • -no-color
  • -state=path
  • -state-out=path
terraform state rm
Description :

Supprime des ressources du state sans les détruire

Options :
  • -backup=path
  • -dry-run ⚠️
  • -lock=false
  • -lock-timeout=0s
  • -no-color
  • -state=path
  • -state-out=path
terraform import
Description :

Importe une ressource existante dans le state

Options :
  • -allow-missing-config
  • -backup=path
  • -config=path
  • -input=false
  • -lock=false
  • -lock-timeout=0s
  • -no-color
  • -parallelism=n
  • -state=path
  • -state-out=path
  • -var=foo=bar
  • -var-file=foo.tfvars ⚠️
terraform workspace list
Description :

Liste tous les workspaces disponibles

Options :
  • -no-color
  • -state=path
terraform workspace new
Description :

Crée un nouveau workspace Terraform

Options :
  • -lock=false
  • -lock-timeout=0s
  • -no-color
  • -state=path
terraform workspace select
Description :

Sélectionne un workspace existant

Options :
  • -no-color
  • -or-create
terraform workspace delete
Description :

Supprime un workspace Terraform

Options :
  • -force ⚠️
  • -lock=false
  • -lock-timeout=0s
  • -no-color
terraform refresh
Description :

Synchronise le state avec l'infrastructure réelle

Options :
  • -backup=path
  • -compact-warnings
  • -input=false
  • -lock=false
  • -lock-timeout=0s
  • -no-color
  • -parallelism=n
  • -state=path
  • -state-out=path
  • -target=resource
  • -var=foo=bar
  • -var-file=foo.tfvars ⚠️
terraform taint
Description :

Marque une ressource pour recréation au prochain apply

Options :
  • -allow-missing
  • -backup=path
  • -ignore-remote-version ⚠️
  • -lock=false
  • -lock-timeout=0s
  • -no-color
  • -state=path
  • -state-out=path
terraform untaint
Description :

Retire la marque taint d'une ressource

Options :
  • -allow-missing
  • -backup=path
  • -lock=false
  • -lock-timeout=0s
  • -no-color
  • -state=path
  • -state-out=path
terraform graph
Description :

Génère un graphe de dépendances des ressources

Options :
  • -draw-cycles
  • -no-color
  • -plan=path
  • -type=plan
terraform providers
Description :

Affiche les providers requis par la configuration

Options :
  • -no-color
terraform providers lock
Description :

Verrouille les versions des providers dans .terraform.lock.hcl

Options :
  • -fs-mirror=path ⚠️
  • -net-mirror=url
  • -no-color
  • -platform=os_arch
terraform version
Description :

Affiche la version de Terraform installée

Options :
  • -json
terraform console
Description :

Lance une console interactive pour évaluer des expressions

Options :
  • -no-color
  • -plan=path
  • -state=path
  • -var=foo=bar
  • -var-file=foo.tfvars ⚠️
terraform force-unlock
Description :

Libère manuellement un verrou de state bloqué

Options :
  • -force ⚠️
  • -no-color
terraform login
Description :

Authentifie auprès de Terraform Cloud ou Enterprise

Options :
  • -no-color
terraform logout
Description :

Supprime les credentials stockés localement

Options :
  • -no-color
terraform get
Description :

Télécharge et installe les modules référencés

Options :
  • -no-color
  • -update
terraform test
Description :

Exécute les tests d'intégration Terraform (.tftest.hcl)

Options :
  • -cloud-run=module ⚠️
  • -filter=file ⚠️
  • -json
  • -no-color
  • -test-directory=path
  • -var=foo=bar
  • -var-file=foo.tfvars ⚠️
  • -verbose

Partager