Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

command/state: mv and rm -backup works #12156

Merged
merged 1 commit into from
Feb 22, 2017
Merged

command/state: mv and rm -backup works #12156

merged 1 commit into from
Feb 22, 2017

Conversation

mitchellh
Copy link
Contributor

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.

This can be backported.

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.
@@ -16,9 +16,8 @@ type StateRmCommand struct {
func (c *StateRmCommand) Run(args []string) int {
args = c.Meta.process(args, true)

var backupPath string
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is so bizarre cause this var was never actually used for anything. Its like I just forgot.

@stack72 stack72 added the core label Feb 22, 2017
@mitchellh mitchellh merged commit d7da828 into master Feb 22, 2017
@mitchellh mitchellh deleted the b-state-backup branch February 22, 2017 19:18
@ghost
Copy link

ghost commented Apr 16, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

-backup option for terraform state mv seems not to work correctly
3 participants