minamijoyo / tfmigrate

A Terraform / OpenTofu state migration tool for GitOps
MIT License
1.14k stars 57 forks source link

Feature request: Display of state plan for to_dir in multi-state #138

Closed matchan26 closed 1 year ago

matchan26 commented 1 year ago

Hi, I have always used this software very frequently. It is a great OSS.

description

migration "multi_state" "mv_dir1_dir2" {
  from_dir = "./old"
  to_dir   = "./new"
  force = true
  actions = [
    "mv aws_iam_user.test_user aws_iam_user.test2_user",
  ]
}

For example, if we want to perform a state operation across multiple directories as described above, the terraform plan is currently executed only on the directory set on from_dir, and the results are output. In this case, the source directory can be guaranteed to be normal, but if we want to guarantee the normality of the destination directory, there is no way to check this with the current tfmigrate. Therefore, when executing the tfmigrate plan, is it possible to execute the terraform plan for the to_dir at the same time as the terraform plan for the from_dir? Thank you!

minamijoyo commented 1 year ago

The multi_state migration usually runs terraform plan not only in the from_dir but also to_dir. Looking at your migration file, I’m aware that you use the force option, which ignores plan diffs. Cloud you try it without the force option?

chrissng commented 1 year ago

Coincidentally this PR would address this issue

https://github.com/minamijoyo/tfmigrate/pull/139

minamijoyo commented 1 year ago

Fixed in v0.3.12 via #139. Thanks for @chrissng