GitHub Actions hashicorp/setup-terraform wrapper conflict
hashicorp/setup-terraform installs a wrapper script in front of terraform so it can expose stdout, stderr, and exitcode as step outputs. Calling terraform from another path, or running two setup steps, makes the wrapper and the real binary disagree.
What this error means
Terraform step outputs (stdout/exitcode) are empty, or a later terraform call behaves differently than the wrapped one, after setup-terraform ran.
github-actions
Error: The process '/usr/local/bin/terraform' failed because one or more lines
were written to the STDERR stream
(terraform_wrapper expected JSON but the real binary was invoked)Common causes
Real binary called instead of the wrapper
A hardcoded path or a tool that re-resolves terraform bypasses the wrapper, so the documented step outputs are never populated.
Wrapper disabled but outputs still consumed
Setting terraform_wrapper: false removes the outputs that a later step references.
How to fix it
Align wrapper usage with how you call terraform
- Keep terraform_wrapper enabled (default) if you read stdout/exitcode outputs.
- Call terraform via PATH so the wrapper is used, not an absolute path.
- If you need the raw binary, set terraform_wrapper: false and stop reading wrapper outputs.
.github/workflows/ci.yml
- uses: hashicorp/setup-terraform@v3
with:
terraform_wrapper: trueHow to prevent it
- Decide once whether you want the wrapper, and keep all terraform calls consistent.
- Reference terraform through PATH inside the same job that ran setup-terraform.
Related guides
GitHub Actions setup-go "Unable to find Go version"Fix actions/setup-go "Unable to find Go version" - the requested Go version is not published for the runner p…
actions/setup-go: Install Go in CIReference for actions/setup-go: install a Go version, enable module and build caching, and read the version f…
GitHub Actions actions/github-script "require is not defined" (ESM)Fix actions/github-script "ReferenceError: require is not defined" - ESM-style imports or top-level await wer…