github.com/hugorut/terraform@v1.1.3/website/docs/cli/commands/state/index.mdx (about)

     1  ---
     2  page_title: 'Command: state'
     3  description: The `terraform state` command is used for advanced state management.
     4  ---
     5  
     6  # State Command
     7  
     8  The `terraform state` command is used for advanced state management.
     9  As your Terraform usage becomes more advanced, there are some cases where
    10  you may need to modify the [Terraform state](/language/state).
    11  Rather than modify the state directly, the `terraform state` commands can
    12  be used in many cases instead.
    13  
    14  This command is a nested subcommand, meaning that it has further subcommands.
    15  These subcommands are listed to the left.
    16  
    17  ## Usage
    18  
    19  Usage: `terraform state <subcommand> [options] [args]`
    20  
    21  Please click a subcommand to the left for more information.
    22  
    23  ## Remote State
    24  
    25  The Terraform state subcommands all work with remote state just as if it
    26  was local state. Reads and writes may take longer than normal as each read
    27  and each write do a full network roundtrip. Otherwise, backups are still
    28  written to disk and the CLI usage is the same as if it were local state.
    29  
    30  ## Backups
    31  
    32  All `terraform state` subcommands that modify the state write backup
    33  files. The path of these backup file can be controlled with `-backup`.
    34  
    35  Subcommands that are read-only (such as [list](/cli/commands/state/list))
    36  do not write any backup files since they aren't modifying the state.
    37  
    38  Note that backups for state modification _can not be disabled_. Due to
    39  the sensitivity of the state file, Terraform forces every state modification
    40  command to write a backup file. You'll have to remove these files manually
    41  if you don't want to keep them around.
    42  
    43  ## Command-Line Friendly
    44  
    45  The output and command-line structure of the state subcommands is
    46  designed to be usable with Unix command-line tools such as grep, awk,
    47  and similar PowerShell commands.
    48  
    49  For advanced filtering and modification, we recommend piping Terraform
    50  state subcommands together with other command line tools.