View output of large plan
tf plan -no-color | subl &
Migrate everything from state A → state B
Temporarily switch to a local states by commenting out any remote backends you have,
and running ‘terraform init’, ‘yes’ to copy the remote to local state files
run:
stateA=pathtostateA
stateB=pathtostateB
ex:
stateA=terraform.tfstate
stateB=../prod/terraform.tfstate
run:
while read p; do tf state mv -dry-run -state $stateA -state-out $stateB $p $p; done < <(tf state list)
Confirm the actions listed are valid, if so re-run without the -dry-run flag
List resources modified in plan
tf plan -no-color | grep -Eo '(?#) ([A-Za-z_][A-Za-z0-9_-]*)\.*(([A-Za-z0-9_-]+)\.)+([A-Za-z0-9_-]+)'