You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The Terramate Cloud sync preview in the CLI is always using terraform to show the plan files. When using OpenTofu and there is a version discrepancy between the binaries in the path (e.g. OpenTofu 1.6.x and Terraform 1.5.x) or when there is no Terraform installed, it results in error.
To Reproduce
Run:
terramate run --continue-on-error \
--cloud-sync-preview \
--cloud-sync-terraform-plan-file=out.tfplan \
--debug-preview-url preview_url.txt \
-- \
tofu plan -out out.tfplan -lock=false
without a terraform binary in the path or with a terraform binary that it is a different version.
Expected behavior
It should use OpenTofu to show the plan files and not result in error.
Log Output
With different versions installed:
2024-04-16T20:07:49-03:00 ERR command stderr action=runTerraformShow command="terraform show -no-color drift.tfplan" planfile=drift.tfplan stack=/x/y/z stderr="\nError: Failed to read the given file as a state or plan file\n\nState read error: Error reading drift.tfplan as a statefile: 2 problems:\n\n- Unsupported state file format: The state file could not be parsed as JSON:\nsyntax error at byte offset 1.\n- Unsupported state file format: The state file does not have a \"version\"\nattribute, which is required to identify the format version.\n\nPlan read error: plan file was created by Terraform 1.6.2, but this is 1.5.7;\nplan files cannot be transferred between different Terraform versions\n"
Without Terraform installed:
024-04-17T18:39:37Z ERR command stderr action=runTerraformShow command="terraform show -no-color out.tfplan" planfile=out.tfplan stack=/x/y/z stderr=
2024-04-17T18:39:37Z WRN failed to synchronize the ASCII plan output error="failed to gather details from plan file: executing: terraform show -no-color out.tfplan" action=getTerraformChangeset planfile=out.tfplan stack=/x/y/z
Environment (please complete the following information):
OS: all
OS: any
Terramate Version: 0.6.2
The text was updated successfully, but these errors were encountered:
turns out that we always call terraform under the hood when syncing plans to Terramate Cloud. We'll provide a fix soon that will allow you to switch to opentofu using the --opentofu flag to switch to tofu similar to what we've done for terragrunt
@soerenmartius sounds great, thanks! Any chance that Terramate can autodetect what binary to use based on the command used for run? You could always override with a flag but from UX point of view it would better IMHO.
mariux
changed the title
Terramate Cloud sync preview is always using Terraform binary
[FEATURE] Add OpenTofu support to Terramate Cloud synchronization
Apr 19, 2024
@soerenmartius sounds great, thanks! Any chance that Terramate can autodetect what binary to use based on the command used for run? You could always override with a flag but from UX point of view it would better IMHO.
good idea, let me discuss this with the team and see what we can come up with
Describe the bug
The Terramate Cloud sync preview in the CLI is always using
terraform
toshow
the plan files. When using OpenTofu and there is a version discrepancy between the binaries in the path (e.g. OpenTofu 1.6.x and Terraform 1.5.x) or when there is no Terraform installed, it results in error.To Reproduce
Run:
without a
terraform
binary in the path or with aterraform
binary that it is a different version.Expected behavior
It should use OpenTofu to
show
the plan files and not result in error.Log Output
With different versions installed:
Without Terraform installed:
Environment (please complete the following information):
The text was updated successfully, but these errors were encountered: