Skip to content

Make Terragrunt plan with the same binary TerraVision reads with - #297

Closed
patrickchugh wants to merge 1 commit into
mainfrom
fix/terragrunt-engine
Closed

patrickchugh wants to merge 1 commit into
mainfrom
fix/terragrunt-engine

Conversation

@patrickchugh

Copy link
Copy Markdown
Owner

Problem

Terragrunt uses OpenTofu by default when tofu is on PATH, while TerraVision's --engine auto prefers terraform. With both installed, Terragrunt wrote the plan with OpenTofu and TerraVision's terraform show failed:

Plan read error: plan file was created by Terraform 1.13.2, but this is 1.15.1;
plan files cannot be transferred between different Terraform versions

This made tests/test_tgwrapper.py::TestTgIntegration::test_terragrunt_full_pipeline fail locally on main (OpenTofu 1.13.2 + Terraform 1.15.1 installed).

Fix

_tg_env() (modules/tgwrapper.py) sets TG_TF_PATH (Terragrunt 0.73+) and TERRAGRUNT_TFPATH (0.50 to 0.72) to TerraVision's engine binary, so --engine now covers Terragrunt too. A binary the user already set in either variable is left alone.

The Terragrunt note in docs/usage-guide.md is updated: users no longer need to set TG_TF_PATH themselves.

Tests

  • 3 new unit tests in TestTgEnv.
  • test_terragrunt_full_pipeline passes with both binaries installed.

Terragrunt defaults to OpenTofu when tofu is on PATH, while TerraVision's
--engine auto prefers terraform. With both installed, Terragrunt wrote
the plan with OpenTofu and TerraVision's terraform show failed: "plan
files cannot be transferred between different Terraform versions".

_tg_env now sets TG_TF_PATH (and TERRAGRUNT_TFPATH for Terragrunt before
0.73) to TerraVision's engine binary, unless the user already set one.
@patrickchugh

Copy link
Copy Markdown
Owner Author

Folded into #296 so the release goes through one CI run.

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 this pull request may close these issues.

1 participant