Terraform state commands have come in useful in safely modularizing existing code. Here are some of the ways I have made use of these commands.
list command is a good way to inspect your existing resources.
show command provides a quick method to inspect resource values. This
comes in handy when viewing values that are not accessible from within
mv command provides a convenient way to refactor your code with
confidence. A resource can be renamed without having to apply new changes.
Another reason might be that the resource has been moved into a module.
rm command is a good way to remove state that no longer needs to be
managed by Terraform. For example, you might do this if you are switching to
a data block or using remote state. This command is not used as much but still
comes in handy.
Terraform state commands are a valuable debugging and refactoring tool that is useful in certain situations. Care should be taken when using these commands with other team members.