Skip to content
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

add support for opentofu for binary plans #67

Closed
quotidian-ennui opened this issue Feb 12, 2024 · 1 comment · Fixed by #68
Closed

add support for opentofu for binary plans #67

quotidian-ennui opened this issue Feb 12, 2024 · 1 comment · Fixed by #68

Comments

@quotidian-ennui
Copy link
Contributor

quotidian-ennui commented Feb 12, 2024

At the moment trying to use tf-summarize with a binary plan that was generated by opentofu does not work.

It will raise the error (version refs will depend on your terraform version, latest opentofu version is 1.6.1)

bsh ❯ tf-summarize .tfplan
error when running 'terraform show -json .tfplan':
╷
│ Error: Couldn't show local plan
│
│ Plan read error: plan file was created by Terraform 1.6.1, but this is
│ 1.6.6; plan files cannot be transferred between different Terraform
│ versions
╵


Make sure you are running in terraform directory and terraform init is done

Workaround

Under the covers, tf-summarize just calls terraform show -json when presented with a binary plan; so just turn it into json via tofu.

bsh ❯ tofu plan -out .tfplan
bsh ❯ tofu show -json .tfplan >.tfplan.json
bsh ❯ tf-summarize .tfplan.json
+--------+----------+
| CHANGE | RESOURCE |
+--------+----------+
+--------+----------+
@kvendingoldo
Copy link

At this moment if you need to have a support of Terraform as well as OpenTofu (and Terragrunt :) ) in one tool you can use https://github.com/tofuutils/tenv which my team wrote some months ago. A lot of users switched to that tool to unify version management in the world of Terraform.

You're welcome to open any issues or contribute to tenv.

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 a pull request may close this issue.

2 participants