tfenv
tfenv copied to clipboard
-chdir doesn't work with an absolute path
$tmpdir="$(mktemp -d)"
$echo 1.2.3 > "$tmpdir/.terraform-version"
$terraform -chdir="$tmpdir" init
Fails with:
cat: /home/ojf/code/tfenv/version: No such file or directory Version could not be resolved (set by /home/ojf/code/tfenv/version or tfenv use
)
The workaround is to ensure it's relative to the current working directory:
$terraform -chdir="$(realpath --relative-to="$PWD" "$tmpdir")" init