website: Update the CLI commands index page for latest help output

My initial motivation here was to update the example output from
Terraform's top-level help list to match recent updates in the layout
and language used.

However, while here I took the opportunity to update some dated language
that was not consistent with our modern documentation writing style,
in particular including a totally unnecessary and potentially-alienating
claim that Terraform is "very easy to use". Our modern writing style
discourages this sort of "boastful" language and encourages us to focus on
the facts at hand.
This commit is contained in:
Martin Atkins 2020-10-23 17:17:59 -07:00
parent 248cf7f13a
commit 6a44586a8f
2 changed files with 52 additions and 59 deletions

View File

@ -105,7 +105,7 @@ func initCommands(
// The command list is included in the terraform -help // The command list is included in the terraform -help
// output, which is in turn included in the docs at // output, which is in turn included in the docs at
// website/source/docs/commands/index.html.markdown; if you // website/docs/commands/index.html.markdown; if you
// add, remove or reclassify commands then consider updating // add, remove or reclassify commands then consider updating
// that to match. // that to match.

View File

@ -3,86 +3,79 @@ layout: "docs"
page_title: "Commands" page_title: "Commands"
sidebar_current: "docs-commands" sidebar_current: "docs-commands"
description: |- 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. Main usage information for the Terraform CLI tool.
--- ---
# Terraform Commands (CLI) # Terraform Commands (CLI)
> **Hands-on:** Try the [Terraform: Get Started](https://learn.hashicorp.com/collections/terraform/aws-get-started?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) collection on HashiCorp Learn. > **Hands-on:** Try the [Terraform: Get Started](https://learn.hashicorp.com/collections/terraform/aws-get-started?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) collection on HashiCorp Learn.
Terraform is controlled via a very easy to use command-line interface (CLI). The command line interface to Terraform is via the `terraform` command, which
Terraform is only a single command-line application: terraform. This application accepts a variety of subcommands such as `terraform init` or `terraform plan`.
then takes a subcommand such as "apply" or "plan". The complete list of subcommands A full list of all of the supported subcommands is in the navigation section
is in the navigation to the left. of this page.
The terraform CLI is a well-behaved command line application. In erroneous cases, We refer to the `terraform` command line tool as "Terraform CLI" elsewhere
a non-zero exit status will be returned. It also responds to -h and --help as you'd in the documentation. This terminology is often used to distinguish it from
most likely expect. other components you might use in the Terraform product family, such as
[Terraform Cloud](/docs/cloud/) or
the various [Terraform providers](/docs/providers/), which are developed and
released separately from Terraform CLI.
To view a list of the available commands at any time, just run terraform with no arguments: To view a list of the commands available in your current Terraform version,
run `terraform` with no additional arguments:
```text ```text
Usage: terraform [global options] <subcommand> [args] Usage: terraform [global options] <subcommand> [args]
The available commands for execution are listed below. The available commands for execution are listed below.
The most common, useful commands are shown first, followed by The primary workflow commands are given first, followed by
less common or more advanced commands. If you're just getting less common or more advanced commands.
started with Terraform, stick with the common commands. For the
other commands, please read the help and docs before usage.
Common commands: Main commands:
apply Builds or changes infrastructure init Prepare your working directory for other commands
console Interactive console for Terraform interpolations validate Check whether the configuration is valid
destroy Destroy Terraform-managed infrastructure plan Show changes required by the current configuration
env Workspace management apply Create or update infrastructure
fmt Rewrites config files to canonical format destroy Destroy previously-created infrastructure
get Download and install modules for the configuration
graph Create a visual graph of Terraform resources
import Import existing infrastructure into Terraform
init Initialize a Terraform working directory
login Obtain and save credentials for a remote host
logout Remove locally-stored credentials for a remote host
output Read an output from a state file
plan Generate and show an execution plan
providers Prints a tree of the providers used in the configuration
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
workspace Workspace management
All other commands: All other commands:
debug Debug output management (experimental) console Try Terraform expressions at an interactive command prompt
force-unlock Manually unlock the terraform state fmt Reformat your configuration in the standard style
state Advanced state management 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
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
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): Global options (use these before the subcommand, if any):
-chdir=DIR Switch to a different working directory before executing -chdir=DIR Switch to a different working directory before executing the
the given subcommand. given subcommand.
-help Show this help output, or the help for a specified -help Show this help output, or the help for a specified subcommand.
subcommand. -version An alias for the "version" subcommand.
-version An alias for the "version" subcommand.
``` ```
To get help for any specific command, use the -help option to the relevant (The output from your current Terraform version may be different than the
subcommand. For example, to see help about the graph subcommand: above example.)
```text To get specific help for any specific command, use the `-help` option with the
$ terraform graph -help relevant subcommand. For example, to see help about the "validate" subcommand
Usage: terraform graph [options] PATH you can run `terraform validate -help`.
Outputs the visual graph of Terraform resources. If the path given is The inline help built in to Terraform CLI describes the most important
the path to a configuration, the dependency graph of the resources are characteristics of each command. For more detailed information, refer to each
shown. If the path is a plan file, then the dependency graph of the command's section of this documentation, available in the navigation
plan itself is shown. section of this page.
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.
```
## Switching working directory with `-chdir` ## Switching working directory with `-chdir`