Mistakes were made. A shared remote state was upgraded to 0.13 and we discovered a module who’s state was stored with 0.11.13. We get “Error: cannot decode dynamic from flatmap” or if we use 0.11 the state version incompatibility error “Error refreshing state: state snapshot was created by Terraform v0.13.5, which is newer than current v0.12.29; upgrade to Terraform v0.13.5 or greater to work with this state”
Is there a method for upgrading the remote state JSON manually? (0.11 -> 0.12 -> 0.13)
If not, is there a sane upgrade path for the remote state in this situation? I ask because now that it’s happened I realize there’s almost certainly more of these 0.11 remote states.
I’ve tried a few things already.
- pull state, change version, upload to backend, and apply. Tries to re-created all resources anew.
- Re-init with 0.11 or 0.12 and apply with a codebase pulled from git history. Similar to above.
- Use 0.12 and insert static values in the code manually to replace remote_state usage (ugh)
- Roll remote state back to 0.12, roll code back to 0.11, apply and deal with the fallout of new resources that were added since 0.13 upgrade
Would really appreciate any tips! Obviously, we’re correcting our terraform upgrade process to include an apply… even if there were no state changes.