Skip to content

-chdir doesn't work with an absolute path #354

@OJFord

Description

@OJFord
$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

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