Skip to content

Print terraform state mv commands on interrupt #22

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

Merged
merged 1 commit into from
Jul 16, 2021

Conversation

pascal-hofmann
Copy link
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
Copy link

codecov bot commented Jul 16, 2021

Codecov Report

Merging #22 (a122b83) into master (cf3b2f6) will decrease coverage by 0.53%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #22      +/-   ##
==========================================
- Coverage   32.40%   31.86%   -0.54%     
==========================================
  Files           5        5              
  Lines         179      182       +3     
==========================================
  Hits           58       58              
- Misses        109      112       +3     
  Partials       12       12              
Impacted Files Coverage Δ
main.go 0.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cf3b2f6...a122b83. Read the comment docs.

@mbode
Copy link
Owner

mbode commented Jul 16, 2021

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
Copy link
Owner

mbode commented Jul 16, 2021

Has been released in 0.4.0.

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