I’ve read an interesting article about how to merge state files: How to Merge State Files – HashiCorp Help Center. In this article, it uses terraform state mv -state=source.tfstate -state-out=destination.tfstate aws_instance.foo aws_instance.foo to move resource between state files.
-state, state-out, and -backup are legacy options supported for the local backend only
I’m wondering whether that is just a warning about the limitation of these options, that are only for local backend. Or that indicates those options will be removed some day?
In the Terraform v1.x compatibility promises the whole terraform state mv command is under Commands that Might Change, which means that we aren’t promising to retain any part of that command through all the v1.x releases.
However, those limitations to the promises are there to allow replacing these older mechanisms with better mechanisms later, and not just to change them for the sake of being annoying. At the moment there is no design for something to replace that command and so no reason to remove it. I can’t promise that will always be true, but I expect those options (and the command itself) will be there for the foreseeable future.
It does mean that we’re unlikely to make any incremental improvements to the behavior though; any missing capabilities are likely to be met by some other mechanism if requested and prioritized, rather than by adding new capabilities to this command.