github.com/Kevinklinger/open_terraform@v0.11.12-beta1/website/docs/state/index.html.md (about) 1 --- 2 layout: "docs" 3 page_title: "State" 4 sidebar_current: "docs-state" 5 description: |- 6 Terraform must store state about your managed infrastructure and configuration. This state is used by Terraform to map real world resources to your configuration, keep track of metadata, and to improve performance for large infrastructures. 7 --- 8 9 # State 10 11 Terraform must store state about your managed infrastructure and 12 configuration. This state is used by Terraform to map real world 13 resources to your configuration, keep track of metadata, and to improve 14 performance for large infrastructures. 15 16 This state is stored by default in a local file named "terraform.tfstate", 17 but it can also be stored remotely, which works better in a team environment. 18 19 Terraform uses this local state to create plans and make changes to your 20 infrastructure. Prior to any operation, Terraform does a 21 [refresh](/docs/commands/refresh.html) to update the state with the 22 real infrastructure. 23 24 For more information on why Terraform requires state and why Terraform cannot 25 function without state, please see the page [state purpose](/docs/state/purpose.html). 26 27 ## Inspection and Modification 28 29 While the format of the state files are just JSON, direct file editing 30 of the state is discouraged. Terraform provides the 31 [terraform state](/docs/commands/state/index.html) command to perform 32 basic modifications of the state using the CLI. 33 34 The CLI usage and output of the state commands is structured to be 35 friendly for Unix tools such as grep, awk, etc. Additionally, the CLI 36 insulates users from any format changes within the state itself. The Terraform 37 project will keep the CLI working while the state format underneath it may 38 shift. 39 40 Finally, the CLI manages backups for you automatically. If you make a mistake 41 modifying your state, the state CLI will always have a backup available for 42 you that you can restore. 43 44 ## Format 45 46 The state is in JSON format and Terraform will promise backwards compatibility 47 with the state file. The JSON format makes it easy to write tools around the 48 state if you want or to modify it by hand in the case of a Terraform bug. 49 The "version" field on the state contents allows us to transparently move 50 the format forward if we make modifications. 51