github.com/pmcatominey/terraform@v0.7.0-rc2.0.20160708105029-1401a52a5cc5/website/source/docs/state/index.html.md (about)

     1  ---
     2  layout: "docs"
     3  page_title: "State"
     4  sidebar_current: "docs-state"
     5  description: |-
     6    Terraform stores state which caches the known state of the world the last time Terraform ran.
     7  ---
     8  
     9  # State
    10  
    11  Terraform stores the state of your managed infrastructure from the last
    12  time Terraform was run. By default this state is stored in a local file
    13  named "terraform.tfstate", but it can also be stored remotely, which works
    14  better in a team environment.
    15  
    16  Terraform uses this local state to create plans and make changes to your
    17  infrastructure. Prior to any operation, Terraform does a
    18  [refresh](/docs/commands/refresh.html) to update the state with the
    19  real infrastructure.
    20  
    21  -> **Note:** Terraform currently requires the state to exist after Terraform
    22  has been run. Technically,
    23  at some point in the future, Terraform should be able to populate the local
    24  state file with the real infrastructure if the file didn't exist. But currently,
    25  Terraform state is a mixture of both a cache and required configuration and
    26  isn't optional.
    27  
    28  ## Inspection and Modification
    29  
    30  While the format of the state files are just JSON, direct file editing
    31  of the state is discouraged. Terraform provides the
    32  [terraform state](/docs/commands/state/index.html) command to perform
    33  basic modifications of the state using the CLI.
    34  
    35  The CLI usage and output of the state commands is structured to be
    36  friendly for Unix tools such as grep, awk, etc. Additionally, the CLI
    37  insulates users from any format changes within the state itself. The Terraform
    38  project will keep the CLI working while the state format underneath it may
    39  shift.
    40  
    41  Finally, the CLI manages backups for you automatically. If you make a mistake
    42  modifying your state, the state CLI will always have a backup available for
    43  you that you can restore.
    44  
    45  ## Format
    46  
    47  The state is in JSON format and Terraform will promise backwards compatibility
    48  with the state file. The JSON format makes it easy to write tools around the
    49  state if you want or to modify it by hand in the case of a Terraform bug.
    50  The "version" field on the state contents allows us to transparently move
    51  the format forward if we make modifications.
    52