Skip to content

Commit

Permalink
feat: update tofuenv pin to not update .opentofu-version if no versio…
Browse files Browse the repository at this point in the history
…n is used
  • Loading branch information
anastasiiakozlova245 committed Dec 30, 2023
1 parent 4316f30 commit 97430ee
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions libexec/tofuenv-pin
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ done;
version_name="$(tofuenv-version-name 2>/dev/null || true)" \
&& log 'debug' "tofuenv-version-name reported: ${version_name}";

echo "${version_name}" > .opentofu-version;
log 'info' "Pinned version by writing \"${version_name}\" to $(pwd)/.opentofu-version";
if [ -n "${version_name}" ]; then
echo "${version_name}" > .opentofu-version;
log 'info' "Pinned version by writing \"${version_name}\" to $(pwd)/.opentofu-version";
else
log 'error' "No version is currently used. Please first set one with: tofuenv use"
fi;

exit 0;

0 comments on commit 97430ee

Please sign in to comment.