-
Notifications
You must be signed in to change notification settings - Fork 57
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
TF_CLI_ARGS_plan="-out=tfplan.out" doesn't work #106
Comments
Oh, I got it. tfmigrate/tfexec/terraform_plan.go Lines 26 to 43 in 6bd3c21
|
Hi @suzuki-shunsuke, Thank you for reporting this! I’m investigating the terraform show command behavior across some versions, and it turns out that the old terraform before v1.1.3 rejects a plan file generated by
It works after this change: hashicorp/terraform#30205. I think this limitation is acceptable for me as long as it works with the latest Terraform version. If no other concerns are found, we could revert the deprecation. |
Thank you for your investigation!
Oh, I didn't know that.
I agree. |
The `tfmigrate plan --out=tfplan` option was initially implemented in tfmigrate v0.2.7 and deprecated in v0.3.0 because the feature was based on a bug before Terraform v1.1. This means that the saved plan file is no longer applicable in Terraform v1.1+. #63 Even though, we found the plan file would still be useful for static analysis such as Conftest. #106 Let’s revert the deprecation and clarify it's intended to use only for static analysis. Note that the old terraform show command before Terraform v1.1.3 rejects a plan file generated by `tfmigrate plan —out=tfplan` as stale. It works after this change. hashicorp/terraform#30205 Use Terraform v1.1.3+ for this feature. I think this limitation is acceptable as long as it works with the latest Terraform.
@suzuki-shunsuke Finally reverted the deprecation in #108. Thank you for reporting this! |
Thank you for your quick update! |
Environment
Overview
I would like to test the result of
tfmigrate plan
with Conftest. refe.g.
To do it, we have to run Conftest against a plan file.
To create a plan file with tfmigrate, I passed the environment variable
TF_CLI_ARGS_plan=-out=tfplan.out
.$ env TF_CLI_ARGS_plan="-out=tfplan.out" tfmigrate plan
But unfortunately, a plan file isn't created.
I think
TF_CLI_ARGS_plan
should work. #27 (comment)How to reproduce
Create a resource for migration.
Change the resource address and create a migration file.
.tfmigrate.hcl
tfmigrate/20220912214947_mv_fooo.hcl
Run
tfmigrate plan
.$ env TF_CLI_ARGS_plan="-out=tfplan.out" tfmigrate plan
Expected Behaviour
tfplan.out
is created.Actual Behaviour
tfplan.out
isn't created.Of course, when we run
terraform plan -out=tfplan.out
, plan file is created properly.Reference
The text was updated successfully, but these errors were encountered: