Print terraform state mv commands on interrupt by pascal-hofmann · Pull Request #22 · mbode/terraform-state-mover · GitHub
Skip to content

Print terraform state mv commands on interrupt - #22

Merged
mbode merged 1 commit into
mbode:masterfrom
pascal-hofmann:print-commands-on-interrupt
Jul 16, 2021
Merged

mbode merged 1 commit into
mbode:masterfrom
pascal-hofmann:print-commands-on-interrupt

Conversation

@pascal-hofmann

Copy link
Copy Markdown
Contributor

When mapping a large number of resources mistakes can happen. Currently, if you abort terraform-state-mover all current mappings are lost. With these changes terraform-state-mover will print the terraform state mv commands for all the mappings that were already selected. The user can then choose to remove the faulty mappings and run the fixed commands himself.

Example output:

Interrupted. These moves would have been executed based on your selections:
terraform state mv 'openstack_networking_port_v2.this[0]' 'module.vm[0].openstack_networking_port_v2.this'
terraform state mv 'openstack_networking_port_v2.this[1]' 'module.vm[1].openstack_networking_port_v2.this'
terraform state mv 'openstack_compute_instance_v2.this[0]' 'module.vm[1].openstack_compute_instance_v2.this'
2021/07/14 14:49:24 ^C

@codecov

codecov Bot commented Jul 16, 2021 •

Copy link
Copy Markdown

Comment thread main.go Outdated
@mbode

mbode commented Jul 16, 2021

Copy link
Copy Markdown
Owner

That's a good idea, thank you for contributing!

@pascal-hofmann
pascal-hofmann force-pushed the print-commands-on-interrupt branch from 03735b6 to a122b83 Compare July 16, 2021 08:07
@mbode
mbode merged commit f9dfb6d into mbode:master Jul 16, 2021
@pascal-hofmann
pascal-hofmann deleted the print-commands-on-interrupt branch July 16, 2021 09:48
@mbode

mbode commented Jul 16, 2021

Copy link
Copy Markdown
Owner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants