Référence complète des commandes Terraform : init, plan, apply, destroy, workspace, state, import et providers.
Initialise le répertoire de travail Terraform
-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
Prévisualise les changements à appliquer
-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⚠️
Applique les changements pour atteindre l'état désiré
-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⚠️
Détruit toute l'infrastructure gérée par Terraform
-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⚠️
Valide les fichiers de configuration Terraform
-json-no-color
Formate les fichiers .tf selon le style canonique
-check-diff-list=false-no-color-recursive⚠️-write=false
Affiche les valeurs des outputs du state
-json-no-color-raw⚠️-state=path
Affiche le state ou le plan en format lisible
-json-no-color
Liste les ressources dans le state Terraform
-id=ID-state=path
Affiche les attributs d'une ressource du state
-no-color-state=path
Déplace une ressource dans le state
-backup=path-backup-out=path-dry-run⚠️-lock=false-lock-timeout=0s-no-color-state=path-state-out=path
Supprime des ressources du state sans les détruire
-backup=path-dry-run⚠️-lock=false-lock-timeout=0s-no-color-state=path-state-out=path
Importe une ressource existante dans le state
-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⚠️
Liste tous les workspaces disponibles
-no-color-state=path
Crée un nouveau workspace Terraform
-lock=false-lock-timeout=0s-no-color-state=path
Sélectionne un workspace existant
-no-color-or-create
Supprime un workspace Terraform
-force⚠️-lock=false-lock-timeout=0s-no-color
Synchronise le state avec l'infrastructure réelle
-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⚠️
Marque une ressource pour recréation au prochain apply
-allow-missing-backup=path-ignore-remote-version⚠️-lock=false-lock-timeout=0s-no-color-state=path-state-out=path
Retire la marque taint d'une ressource
-allow-missing-backup=path-lock=false-lock-timeout=0s-no-color-state=path-state-out=path
Génère un graphe de dépendances des ressources
-draw-cycles-no-color-plan=path-type=plan
Affiche les providers requis par la configuration
-no-color
Verrouille les versions des providers dans .terraform.lock.hcl
-fs-mirror=path⚠️-net-mirror=url-no-color-platform=os_arch
Affiche la version de Terraform installée
-json
Lance une console interactive pour évaluer des expressions
-no-color-plan=path-state=path-var=foo=bar-var-file=foo.tfvars⚠️
Libère manuellement un verrou de state bloqué
-force⚠️-no-color
Authentifie auprès de Terraform Cloud ou Enterprise
-no-color
Supprime les credentials stockés localement
-no-color
Télécharge et installe les modules référencés
-no-color-update
Exécute les tests d'intégration Terraform (.tftest.hcl)
-cloud-run=module⚠️-filter=file⚠️-json-no-color-test-directory=path-var=foo=bar-var-file=foo.tfvars⚠️-verbose