Skip to content

cdktn CLI ignores terraformBinaryName / CDKTF_TERRAFORM_BINARY_NAME in GitHub Actions #96

@jjrawlins

Description

@jjrawlins

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:

  1. terraformBinaryName: "tofu" in cdktf.json
  2. CDKTF_TERRAFORM_BINARY_NAME=tofu environment variable
  3. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions