website: documenting the CLI

This commit is contained in:
Armon Dadgar 2014-07-24 12:02:10 -04:00
parent 3808775d67
commit 1a94a239e4
5 changed files with 132 additions and 42 deletions

View File

@ -1,16 +0,0 @@
---
layout: "docs"
page_title: "Commands: Agent"
sidebar_current: "docs-commands-agent"
---
# Terraform Agent
The `terraform agent` command is the heart of Terraform: it runs the agent that
performs the important task of maintaining membership information,
running checks, announcing services, handling queries, etc.
Due to the power and flexibility of this command, the Terraform agent
is documented in its own section. See the [Terraform Agent](/docs/agent/basics.html)
section for more information on how to use this command and the
options it has.

View File

@ -0,0 +1,50 @@
---
layout: "docs"
page_title: "Commands"
sidebar_current: "docs-commands"
---
# 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:
```
$ terraform
usage: terraform [--version] [--help] <command> [<args>]
Available commands are:
apply Builds or changes infrastructure
graph Create a visual graph of Terraform resources
output Read an output from a state file
plan Generate and show an execution plan
refresh Update local state file against real resources
show Inspect Terraform state or plan
version Prints the Terraform version
```
To get help for any specific command, pass the -h flag to the relevant subcommand. For example,
to see help about the members subcommand:
```
$ 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.
```

View File

@ -0,0 +1,40 @@
---
layout: "docs"
page_title: "Command: refresh"
sidebar_current: "docs-commands-refresh"
---
# Command: refresh
The `terraform refresh` command is used to reconcile the state Terraform
knows about (via it's state file) with the real-world infrastructure.
The can be used to detect any drift from the last-known state, and to
update the state file.
This does not modify infrastructure, but does modify the state file.
If the state is changed, this may cause changes to occur during the next
plan or apply.
## Usage
Usage: `terraform refresh [options] [dir]`
By default, `refresh` requires no flags and looks in the current directory
for the configuration and state file to refresh.
The command-line flags are all optional. The list of available flags are:
* `-no-color` - Disables output with coloring
* `-state=path` - Path to read and write the state file to. Defaults to "terraform.tfstate".
* `-state-out=path` - Path to write updated state file. By default, the
`-state` path will be used.
* `-var 'foo=bar'` - Set a variable in the Terraform configuration. This
flag can be set multiple times.
* `-var-file=foo` - Set variables in the Terraform configuration from
a file. If "terraform.tfvars" is present, it will be automatically
loaded if this flag is not specified.

View File

@ -0,0 +1,24 @@
---
layout: "docs"
page_title: "Command: show"
sidebar_current: "docs-commands-show"
---
# Command: show
The `terraform show` command is used to provide human-readable output
from a state or plan file. This can be used to inspect a plan to ensure
that the planned operations are expected, or to inspect the current state
as terraform sees it.
## Usage
Usage: `terraform show [options] <path>`
You must call `show` with a path to either a Terraform state file or plan
file.
The command-line flags are all optional. The list of available flags are:
* `-no-color` - Disables output with coloring

View File

@ -15,37 +15,29 @@
<li<%= sidebar_current("docs-commands") %>>
<a href="/docs/commands/index.html">Commands (CLI)</a>
<ul class="nav">
<li<%= sidebar_current("docs-commands-agent") %>>
<a href="/docs/commands/agent.html">agent</a>
</li>
<li<%= sidebar_current("docs-commands-forceleave") %>>
<a href="/docs/commands/force-leave.html">force-leave</a>
</li>
<li<%= sidebar_current("docs-commands-join") %>>
<a href="/docs/commands/join.html">join</a>
</li>
<li<%= sidebar_current("docs-commands-keygen") %>>
<a href="/docs/commands/keygen.html">keygen</a>
<li<%= sidebar_current("docs-commands-apply") %>>
<a href="/docs/commands/apply.html">apply</a>
</li>
<li<%= sidebar_current("docs-commands-leave") %>>
<a href="/docs/commands/leave.html">leave</a>
</li>
<li<%= sidebar_current("docs-commands-members") %>>
<a href="/docs/commands/members.html">members</a>
</li>
<li<%= sidebar_current("docs-commands-monitor") %>>
<a href="/docs/commands/monitor.html">monitor</a>
<li<%= sidebar_current("docs-commands-graph") %>>
<a href="/docs/commands/graph.html">graph</a>
</li>
<li<%= sidebar_current("docs-commands-info") %>>
<a href="/docs/commands/info.html">info</a>
<li<%= sidebar_current("docs-commands-output") %>>
<a href="/docs/commands/output.html">output</a>
</li>
<li<%= sidebar_current("docs-commands-plan") %>>
<a href="/docs/commands/plan.html">plan</a>
</li>
<li<%= sidebar_current("docs-commands-refresh") %>>
<a href="/docs/commands/refresh.html">refresh</a>
</li>
<li<%= sidebar_current("docs-commands-show") %>>
<a href="/docs/commands/show.html">show</a>
</li>
</ul>
</li>