Tfenv: Cannot find .terraform-version on OSX

Created on 30 Aug 2018  ·  4Comments  ·  Source: tfutils/tfenv

Using tfenv 0.6.0. I installed tfenv using brew install tfenv.

I have this in my .terraform-version

terraform {
  required_version  = ">= 0.10.0, <0.12.3"
}
✗ tfenv install
tfenv: tfenv-install: [ERROR] No versions matching '' found in remote
✗ cat /usr/local/Cellar/tfenv/0.6.0/libexec/tfenv-version-file
✗ find_local_version_file() {
  local root="${1}"
  while ! [[ "${root}" =~ ^//[^/]*$ ]]; do
    if [ -e "${root}/.terraform-version" ]; then
      echo "${root}/.terraform-version"
      return 0
    fi
    [ -n "${root}" ] || break
    root="${root%/*}"
  done
  return 1
}
✗ find_local_version_file
✗find_local_version_file .
./.terraform-version

I believe the issue is with the path sent to find_local_version_file.

documentation moreinfo

Most helpful comment

I don't understand the README section regarding this, it's very misleading and seems very wrong. @kjhosein is correct. Note that this is nothing to do with Mac OS

All 4 comments

Hello @nitrocode,

I was also confused by the docs.
The terraform {...} code you have is read by Terraform, but not by tfenv.
Instead in your .terraform-version, you need a version # or a variation on that. For example:

0.9.11
or
latest:^0.11

HTH!

I don't understand the README section regarding this, it's very misleading and seems very wrong. @kjhosein is correct. Note that this is nothing to do with Mac OS

Proposed improvements to the documentation?

This did help. I replaced my .terraform-version contents with simply

0.11.14
Was this page helpful?
0 / 5 - 0 ratings

Related issues

larsLarski picture larsLarski  ·  3Comments

gudlyf picture gudlyf  ·  10Comments

Constantin07 picture Constantin07  ·  8Comments

ibakayoko picture ibakayoko  ·  6Comments

sthristov picture sthristov  ·  5Comments