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

Print terraform state mv commands on interrupt#22
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

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.

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

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