github.com/iaas-resource-provision/iaas-rpc@v1.0.7-0.20211021023331-ed21f798c408/website/docs/cli/commands/index.html.md (about)

     1  ---
     2  layout: "docs"
     3  page_title: "Basic CLI Features"
     4  sidebar_current: "docs-commands"
     5  description: "An introduction to the terraform command and its available subcommands."
     6  ---
     7  
     8  # Basic CLI Features
     9  
    10  > **Hands-on:** Try the [RPC(Resource Provision Center): 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.
    11  
    12  The command line interface to RPC(Resource Provision Center) is via the `iaas-rpc` command, which
    13  accepts a variety of subcommands such as `iaas-rpc init` or `iaas-rpc plan`.
    14  A full list of all of the supported subcommands is in the navigation section
    15  of this page.
    16  
    17  We refer to the `iaas-rpc` command line tool as "RPC(Resource Provision Center) CLI" elsewhere
    18  in the documentation. This terminology is often used to distinguish it from
    19  other components you might use in the RPC(Resource Provision Center) product family, such as
    20  [RPC(Resource Provision Center) Cloud](/docs/cloud/) or
    21  the various [RPC(Resource Provision Center) providers](/docs/language/providers/index.html), which
    22  are developed and released separately from RPC(Resource Provision Center) CLI.
    23  
    24  To view a list of the commands available in your current RPC(Resource Provision Center) version,
    25  run `iaas-rpc` with no additional arguments:
    26  
    27  ```text
    28  Usage: iaas-rpc [global options] <subcommand> [args]
    29  
    30  The available commands for execution are listed below.
    31  The primary workflow commands are given first, followed by
    32  less common or more advanced commands.
    33  
    34  Main commands:
    35    init          Prepare your working directory for other commands
    36    validate      Check whether the configuration is valid
    37    plan          Show changes required by the current configuration
    38    apply         Create or update infrastructure
    39    destroy       Destroy previously-created infrastructure
    40  
    41  All other commands:
    42    console       Try iaas-rpc expressions at an interactive command prompt
    43    fmt           Reformat your configuration in the standard style
    44    force-unlock  Release a stuck lock on the current workspace
    45    get           Install or upgrade remote RPC(Resource Provision Center) modules
    46    graph         Generate a Graphviz graph of the steps in an operation
    47    import        Associate existing infrastructure with a RPC(Resource Provision Center) resource
    48    login         Obtain and save credentials for a remote host
    49    logout        Remove locally-stored credentials for a remote host
    50    output        Show output values from your root module
    51    providers     Show the providers required for this configuration
    52    refresh       Update the state to match remote systems
    53    show          Show the current state or a saved plan
    54    state         Advanced state management
    55    taint         Mark a resource instance as not fully functional
    56    untaint       Remove the 'tainted' state from a resource instance
    57    version       Show the current RPC(Resource Provision Center) version
    58    workspace     Workspace management
    59  
    60  Global options (use these before the subcommand, if any):
    61    -chdir=DIR    Switch to a different working directory before executing the
    62                  given subcommand.
    63    -help         Show this help output, or the help for a specified subcommand.
    64    -version      An alias for the "version" subcommand.
    65  ```
    66  
    67  (The output from your current RPC(Resource Provision Center) version may be different than the
    68  above example.)
    69  
    70  To get specific help for any specific command, use the `-help` option with the
    71  relevant subcommand. For example, to see help about the "validate" subcommand
    72  you can run `terraform validate -help`.
    73  
    74  The inline help built in to RPC(Resource Provision Center) CLI describes the most important
    75  characteristics of each command. For more detailed information, refer to each
    76  command's section of this documentation, available in the navigation
    77  section of this page.
    78  
    79  ## Switching working directory with `-chdir`
    80  
    81  The usual way to run RPC(Resource Provision Center) is to first switch to the directory containing
    82  the `.tf` files for your root module (for example, using the `cd` command), so
    83  that RPC(Resource Provision Center) will find those files automatically without any extra arguments.
    84  
    85  In some cases though — particularly when wrapping RPC(Resource Provision Center) in automation
    86  scripts — it can be convenient to run RPC(Resource Provision Center) from a different directory than
    87  the root module directory. To allow that, RPC(Resource Provision Center) supports a global option
    88  `-chdir=...` which you can include before the name of the subcommand you intend
    89  to run:
    90  
    91  ```
    92  terraform -chdir=environments/production apply
    93  ```
    94  
    95  The `chdir` option instructs RPC(Resource Provision Center) to change its working directory to the
    96  given directory before running the given subcommand. This means that any files
    97  that RPC(Resource Provision Center) would normally read or write in the current working directory
    98  will be read or written in the given directory instead.
    99  
   100  There are two exceptions where RPC(Resource Provision Center) will use the original working directory
   101  even when you specify `-chdir=...`:
   102  
   103  * Settings in the [CLI Configuration](/docs/cli/config/config-file.html) are not for a specific
   104    subcommand and RPC(Resource Provision Center) processes them before acting on the `-chdir`
   105    option.
   106  
   107  * In case you need to use files from the original working directory as part
   108    of your configuration, a reference to `path.cwd` in the configuration will
   109    produce the original working directory instead of the overridden working
   110    directory. Use `path.root` to get the root module directory.
   111  
   112  ## Shell Tab-completion
   113  
   114  If you use either `bash` or `zsh` as your command shell, RPC(Resource Provision Center) can provide
   115  tab-completion support for all command names and (at this time) _some_ command
   116  arguments.
   117  
   118  To add the necessary commands to your shell profile, run the following command:
   119  
   120  ```bash
   121  terraform -install-autocomplete
   122  ```
   123  
   124  After installation, it is necessary to restart your shell or to re-read its
   125  profile script before completion will be activated.
   126  
   127  To uninstall the completion hook, assuming that it has not been modified
   128  manually in the shell profile, run the following command:
   129  
   130  ```bash
   131  terraform -uninstall-autocomplete
   132  ```
   133  
   134  Currently not all of RPC(Resource Provision Center)'s subcommands have full tab-completion support
   135  for all arguments. We plan to improve tab-completion coverage over time.
   136  
   137  ## Upgrade and Security Bulletin Checks
   138  
   139  The RPC(Resource Provision Center) CLI commands interact with the HashiCorp service
   140  [Checkpoint](https://checkpoint.hashicorp.com/) to check for the availability
   141  of new versions and for critical security bulletins about the current version.
   142  
   143  One place where the effect of this can be seen is in `terraform version`, where
   144  it is used by default to indicate in the output when a newer version is
   145  available.
   146  
   147  Only anonymous information, which cannot be used to identify the user or host,
   148  is sent to Checkpoint. An anonymous ID is sent which helps de-duplicate warning
   149  messages. Both the anonymous id and the use of checkpoint itself are completely
   150  optional and can be disabled.
   151  
   152  Checkpoint itself can be entirely disabled for all HashiCorp products by
   153  setting the environment variable `CHECKPOINT_DISABLE` to any non-empty value.
   154  
   155  Alternatively, settings in
   156  [the CLI configuration file](/docs/cli/config/config-file.html) can be used to
   157  disable checkpoint features. The following checkpoint-related settings are
   158  supported in this file:
   159  
   160  * `disable_checkpoint` - set to `true` to disable checkpoint calls
   161    entirely. This is similar to the `CHECKPOINT_DISABLE` environment variable
   162    described above.
   163  
   164  * `disable_checkpoint_signature` - set to `true` to disable the use of an
   165    anonymous signature in checkpoint requests. This allows RPC(Resource Provision Center) to check
   166    for security bulletins but does not send the anonymous signature in these
   167    requests.
   168  
   169  [The Checkpoint client code](https://github.com/hashicorp/go-checkpoint) used
   170  by RPC(Resource Provision Center) is available for review by any interested party.