terraform/states/statefile
Martin Atkins 1ae47ae314 states/statefile: tolerate and ignore invalid depends_on in version 3
The state refactoring command "terraform state mv" in Terraform 0.11 does
not update existing dependency addresses recorded in the state when it
moves objects around, and Terraform only updates the dependency addresses
in the state when it performs a full update on a resource instance, and
so it's a common problem for folks updating from Terraform 0.11 with
resource names that are not valid identifiers to run into state upgrade
errors even though they have followed the instructions produced by
"terraform 0.12checklist".

Dependencies are synced from config during every refresh walk anyway, so
in practice we can get away with just discarding invalid dependency
addresses and letting the refresh walk update them. In practice these
addresses are unlikely to be pointing at a resource that actually exists
anyway, because if so Terraform 0.12's configuration parser wouldn't be
able to interpret it.

Discarding invalid dependency addresses allows the state upgrade to
complete successfully in such cases and thus gives the refresh step an
opportunity to repair the problem.
2019-11-21 09:18:49 -08:00
..
testdata/roundtrip states/statefile: tolerate and ignore invalid depends_on in version 3 2019-11-21 09:18:49 -08:00
diagnostics.go statefile: New package for loading and saving state files 2018-10-16 18:49:20 -07:00
doc.go statefile: New package for loading and saving state files 2018-10-16 18:49:20 -07:00
file.go states/statefile: Tolerate nil state in statefile.New 2018-10-16 19:14:11 -07:00
marshal_equal.go command: Allow tests to run to completion without panics or hangs 2018-10-16 19:14:11 -07:00
read.go command: Fix TestInit_getProvider 2018-11-12 15:19:55 -08:00
roundtrip_test.go read+write the new dependencies in the statefile 2019-11-07 17:49:03 -05:00
version0.go statefile: New package for loading and saving state files 2018-10-16 18:49:20 -07:00
version1.go statefile: New package for loading and saving state files 2018-10-16 18:49:20 -07:00
version1_upgrade.go statefile: New package for loading and saving state files 2018-10-16 18:49:20 -07:00
version2.go states/statefile: decode backend hash as uint64 2019-05-28 23:59:36 +09:00
version2_upgrade.go statefile: New package for loading and saving state files 2018-10-16 18:49:20 -07:00
version3.go statefile: New package for loading and saving state files 2018-10-16 18:49:20 -07:00
version3_upgrade.go states/statefile: tolerate and ignore invalid depends_on in version 3 2019-11-21 09:18:49 -08:00
version4.go read+write the new dependencies in the statefile 2019-11-07 17:49:03 -05:00
write.go always write the current state terraform_version 2019-05-21 18:55:53 -04:00