Description
When running cdktn deploy or cdktn diff in GitHub Actions with OpenTofu installed (via opentofu/setup-opentofu@v1), the CLI fails to resolve the tofu binary even when configured via:
terraformBinaryName: "tofu" in cdktf.json
CDKTF_TERRAFORM_BINARY_NAME=tofu environment variable
TERRAFORM_BINARY_NAME=tofu environment variable (per docs)
The CLI still attempts to spawn terraform and fails with ENOENT.
Workaround
Symlinking tofu as terraform:
- name: Symlink tofu as terraform
run: ln -sf $(which tofu) /usr/local/bin/terraform
Expected Behavior
The CLI should honor terraformBinaryName from cdktf.json or the CDKTF_TERRAFORM_BINARY_NAME / TERRAFORM_BINARY_NAME environment variables and use the configured binary name when spawning Terraform/OpenTofu subprocesses.
Environment
- cdktn-cli: latest (installed via npm)
- OpenTofu: installed via
opentofu/setup-opentofu@v1
- Platform: GitHub Actions (ubuntu-latest)
- Node.js: LTS
Description
When running
cdktn deployorcdktn diffin GitHub Actions with OpenTofu installed (viaopentofu/setup-opentofu@v1), the CLI fails to resolve thetofubinary even when configured via:terraformBinaryName: "tofu"incdktf.jsonCDKTF_TERRAFORM_BINARY_NAME=tofuenvironment variableTERRAFORM_BINARY_NAME=tofuenvironment variable (per docs)The CLI still attempts to spawn
terraformand fails withENOENT.Workaround
Symlinking
tofuasterraform:Expected Behavior
The CLI should honor
terraformBinaryNamefromcdktf.jsonor theCDKTF_TERRAFORM_BINARY_NAME/TERRAFORM_BINARY_NAMEenvironment variables and use the configured binary name when spawning Terraform/OpenTofu subprocesses.Environment
opentofu/setup-opentofu@v1