2
votes

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).

  • Internet Connection Issues
  • Kubernetes Timeout
  • Bug in Scipts/Dependencies

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

1

1 Answers

6
votes

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.