Srinath Ganesh
Srinath Ganesh

Reputation: 2558

Is there any way to manually edit/tamper the terraform.tfstate file?

I have Helm Applciations being deployed with Terraform, using the helm_release resource of Terraform.

Sometimes due to one or more of the following reasons my Kubernetes Pods would start to run in the Kubernetes Cluster, BUT Terraform is unaware of this (due to reason(s) below).

Is there any way to manually edit/tamper terraform.tfstate OR any way to sync terraform based on the remote environment?

Upvotes: 2

Views: 10251

Answers (1)

Rohit
Rohit

Reputation: 1301

You can edit the terraform state manually but it is highly discouraged. See this official documentation.

The terraform state <subcommand> [options] [args] command provides very basic options.

One way is to take a backup of the state files + configuration files and remove the state file. Perform terraform import to resync your config and then state.

When doing this don't forget to take the backups first.

Upvotes: 6

Related Questions