github.com/hs0210/hashicorp-terraform@v0.11.12-beta1/website/docs/commands/index.html.markdown (about)

     1  ---
     2  layout: "docs"
     3  page_title: "Commands"
     4  sidebar_current: "docs-commands"
     5  description: |-
     6    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.
     7  ---
     8  
     9  # Terraform Commands (CLI)
    10  
    11  Terraform is controlled via a very easy to use command-line interface (CLI).
    12  Terraform is only a single command-line application: terraform. This application
    13  then takes a subcommand such as "apply" or "plan". The complete list of subcommands
    14  is in the navigation to the left.
    15  
    16  The terraform CLI is a well-behaved command line application. In erroneous cases,
    17  a non-zero exit status will be returned. It also responds to -h and --help as you'd
    18  most likely expect.
    19  
    20  To view a list of the available commands at any time, just run terraform with no arguments:
    21  
    22  ```text
    23  $ terraform
    24  Usage: terraform [--version] [--help] <command> [args]
    25  
    26  The available commands for execution are listed below.
    27  The most common, useful commands are shown first, followed by
    28  less common or more advanced commands. If you're just getting
    29  started with Terraform, stick with the common commands. For the
    30  other commands, please read the help and docs before usage.
    31  
    32  Common commands:
    33      apply              Builds or changes infrastructure
    34      console            Interactive console for Terraform interpolations
    35      destroy            Destroy Terraform-managed infrastructure
    36      fmt                Rewrites config files to canonical format
    37      get                Download and install modules for the configuration
    38      graph              Create a visual graph of Terraform resources
    39      import             Import existing infrastructure into Terraform
    40      init               Initialize a new or existing Terraform configuration
    41      output             Read an output from a state file
    42      plan               Generate and show an execution plan
    43      providers          Prints a tree of the providers used in the configuration
    44      push               Upload this Terraform module to Terraform Enterprise to run
    45      refresh            Update local state file against real resources
    46      show               Inspect Terraform state or plan
    47      taint              Manually mark a resource for recreation
    48      untaint            Manually unmark a resource as tainted
    49      validate           Validates the Terraform files
    50      version            Prints the Terraform version
    51      workspace          Workspace management
    52  
    53  All other commands:
    54      debug              Debug output management (experimental)
    55      force-unlock       Manually unlock the terraform state
    56      state              Advanced state management
    57  ```
    58  
    59  To get help for any specific command, pass the -h flag to the relevant subcommand. For example,
    60  to see help about the graph subcommand:
    61  
    62  ```text
    63  $ terraform graph -h
    64  Usage: terraform graph [options] PATH
    65  
    66    Outputs the visual graph of Terraform resources. If the path given is
    67    the path to a configuration, the dependency graph of the resources are
    68    shown. If the path is a plan file, then the dependency graph of the
    69    plan itself is shown.
    70  
    71    The graph is outputted in DOT format. The typical program that can
    72    read this format is GraphViz, but many web services are also available
    73    to read this format.
    74  ```
    75  
    76  ## Shell Tab-completion
    77  
    78  If you use either `bash` or `zsh` as your command shell, Terraform can provide
    79  tab-completion support for all command names and (at this time) _some_ command
    80  arguments.
    81  
    82  To add the necessary commands to your shell profile, run the following command:
    83  
    84  ```bash
    85  terraform -install-autocomplete
    86  ```
    87  
    88  After installation, it is necessary to restart your shell or to re-read its
    89  profile script before completion will be activated.
    90  
    91  To uninstall the completion hook, assuming that it has not been modified
    92  manually in the shell profile, run the following command:
    93  
    94  ```bash
    95  terraform -uninstall-autocomplete
    96  ```
    97  
    98  Currently not all of Terraform's subcommands have full tab-completion support
    99  for all arguments. We plan to improve tab-completion coverage over time.
   100  
   101  ## Upgrade and Security Bulletin Checks
   102  
   103  The Terraform CLI commands interact with the HashiCorp service
   104  [Checkpoint](https://checkpoint.hashicorp.com/) to check for the availability
   105  of new versions and for critical security bulletins about the current version.
   106  
   107  One place where the effect of this can be seen is in `terraform version`, where
   108  it is used by default to indicate in the output when a newer version is
   109  available.
   110  
   111  Only anonymous information, which cannot be used to identify the user or host,
   112  is sent to Checkpoint. An anonymous ID is sent which helps de-duplicate warning
   113  messages. Both the anonymous id and the use of checkpoint itself are completely
   114  optional and can be disabled.
   115  
   116  Checkpoint itself can be entirely disabled for all HashiCorp products by
   117  setting the environment variable `CHECKPOINT_DISABLE` to any non-empty value.
   118  
   119  Alternatively, settings in
   120  [the CLI configuration file](/docs/commands/cli-config.html) can be used to
   121  disable checkpoint features. The following checkpoint-related settings are
   122  supported in this file:
   123  
   124  * `disable_checkpoint` - set to `true` to disable checkpoint calls
   125    entirely. This is similar to the `CHECKPOINT_DISABLE` environment variable
   126    described above.
   127  
   128  * `disable_checkpoint_signature` - set to `true` to disable the use of an
   129    anonymous signature in checkpoint requests. This allows Terraform to check
   130    for security bulletins but does not send the anonymous signature in these
   131    requests.
   132  
   133  [The Checkpoint client code](https://github.com/hashicorp/go-checkpoint) used
   134  by Terraform is available for review by any interested party.