2014-07-24 18:02:10 +02:00
---
layout: "docs"
page_title: "Commands"
sidebar_current: "docs-commands"
2014-10-22 05:21:56 +02:00
description: |-
Terraform is controlled via a very easy to use command-line interface (CLI). Terraform is only a single command-line application: terraform. This application then takes a subcommand such as "apply" or "plan". The complete list of subcommands is in the navigation to the left.
2014-07-24 18:02:10 +02:00
---
# Terraform Commands (CLI)
Terraform is controlled via a very easy to use command-line interface (CLI).
Terraform is only a single command-line application: terraform. This application
then takes a subcommand such as "apply" or "plan". The complete list of subcommands
is in the navigation to the left.
The terraform CLI is a well-behaved command line application. In erroneous cases,
a non-zero exit status will be returned. It also responds to -h and --help as you'd
most likely expect.
To view a list of the available commands at any time, just run terraform with no arguments:
2017-04-17 12:17:54 +02:00
```text
2014-07-24 18:02:10 +02:00
$ terraform
2016-12-30 01:32:30 +01:00
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
2017-04-04 19:48:59 +02:00
env Environment management
2016-12-30 01:32:30 +01:00
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
2017-02-13 20:15:40 +01:00
init Initialize a new or existing Terraform configuration
2016-12-30 01:32:30 +01:00
output Read an output from a state file
plan Generate and show an execution plan
2017-04-29 00:32:23 +02:00
providers Prints a tree of the providers used in the configuration
2017-03-23 20:28:10 +01:00
push Upload this Terraform module to Terraform Enterprise to run
2016-12-30 01:32:30 +01:00
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
All other commands:
debug Debug output management (experimental)
2017-04-04 19:48:59 +02:00
force-unlock Manually unlock the terraform state
2016-12-30 01:32:30 +01:00
state Advanced state management
2014-07-24 18:02:10 +02:00
```
To get help for any specific command, pass the -h flag to the relevant subcommand. For example,
2017-01-05 22:21:01 +01:00
to see help about the graph subcommand:
2014-07-24 18:02:10 +02:00
2017-04-17 12:17:54 +02:00
```text
2014-07-24 18:02:10 +02:00
$ terraform graph -h
Usage: terraform graph [options] PATH
Outputs the visual graph of Terraform resources. If the path given is
the path to a configuration, the dependency graph of the resources are
shown. If the path is a plan file, then the dependency graph of the
plan itself is shown.
The graph is outputted in DOT format. The typical program that can
read this format is GraphViz, but many web services are also available
to read this format.
```