Commit Graph

8 Commits

Author SHA1 Message Date
James Bardin 43c7bd648c fix sorting of module resources during state mv
Module resource were being sorted lexically by name by the state filter.
If there are 10 or more resources, the order won't match the index
order, and resources will have different indexes in their new location.

Sort the FilterResults by index numerically when the names match.

Clean up the module String output for visual inspection by sorting
Resource name parts numerically when they are an integer value.
2017-02-23 18:27:16 -05:00
Mitchell Hashimoto e4d2193ed6
command/state: mv and rm -backup works
Fixes #12154

The "-backup" flag before for "state *" CLI had some REALLY bizarre behavior:
it would change the _destination_ state and actually not create any
additional backup at all (the original state was unchanged and the
normal timestamped backup still are written). Really weird.

This PR makes the -backup flag work as you'd expect with one caveat:
we'll _still_ create the timestamped backup file. The timestamped backup
file helps make sure that you always get a backup history when using
these commands. We don't want to make it easy for you to overwrite a
state with the `-backup` flag.
2017-02-21 21:10:03 -08:00
Mitchell Hashimoto 0d1ea84d39
command: test for moving resource with count [GH-7797] 2016-08-19 12:05:20 -04:00
Mitchell Hashimoto 3b3f92cd9b
terraform: fix some test failures on state add with multiple modules 2016-08-18 17:39:07 -04:00
Mitchell Hashimoto a44c8b8760
terraform: state mv tests 2016-08-18 15:05:42 -04:00
Mitchell Hashimoto 32d0d29b56
command: test for moving into another state file 2016-05-10 13:25:04 -07:00
Mitchell Hashimoto 235e860118
command/state mv: handle -state-out to a different path 2016-05-10 13:25:04 -07:00
Mitchell Hashimoto c4e5355a02
command/state mv 2016-05-10 13:25:03 -07:00