Much like application software releases can have accompanying database migrations to massage tables and schemas to match with the new application code, I think it would be nice to have a feature like this for terraform. Here’s the issue:
Sometimes when I make an update to a module, I make a change to an underlying resource that requires a
state mv operation to be done before the first apply is done with the upgraded module. I (or someone else that paid attention to the README) have to manually run a
terraform state mv foo bar before the apply or incur a possible outage because a resource will be destroyed and recreated. If there could be an accompanying “migration” definition that could trigger certain actions so that the state mv command(s) would be automatically run along with the apply, this would make life easier :).
Has anyone else had this thought? Implementation ideas?