You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
terraform/website/docs/cli/state/index.mdx

39 lines
2.2 KiB

---
page_title: Update Terraform state manually
description: >-
State data is the record of how real-world objects map to resources in the Terraform configuration. Learn how to manually update with state data.
---
⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️
> [!IMPORTANT]
> **Documentation Update:** Product documentation previously located in `/website` has moved to the [`hashicorp/web-unified-docs`](https://github.com/hashicorp/web-unified-docs) repository, where all product documentation is now centralized. Please make contributions directly to `web-unified-docs`, since changes to `/website` in this repository will not appear on developer.hashicorp.com.
⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️
# Update Terraform state manually overview
This topic provides overview information about how to manually update state in Terraform.
> **Hands-on:** Try the [Manage Resources in Terraform State](/terraform/tutorials/state/state-cli?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial.
## Introduction
Terraform stores information about real-world object that correspond to resources in the configuration as [state data](/terraform/language/state).
Doing so allows Terraform to modify an existing object when its resource declaration changes.
Terraform automatically updates state when you run the `terraform plan` and `terraform apply` commands, but you may need to manually adjustment state data as a result of changes to the configuration or the real managed infrastructure.
## Workflow
Modifying state data outside of normal `terraform plan` or `terraform apply` operations can cause Terraform to lose track of managed resources, leading to increased costs, reduced productivity, or compromised security. Make sure to keep backups of your state data if you choose to manually modify state.
You can use the Terraform CLI to perform the following state interations:
- [Inspect state](/terraform/cli/state/inspect)
- [Re-create resources](/terraform/cli/state/taint)
- [Move resources](/terraform/cli/state/move)
- [Import existing resources](/terraform/cli/import)
- [Recover state from backup](/terraform/cli/state/recover)