Terraform
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 tutorial.
Introduction
Terraform stores information about real-world object that correspond to resources in the configuration as state data. 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: