Tfenv: Problema con TFENV_AUTO_INSTALL y más reciente:<regex>sintaxis</regex>

Creado en 6 oct. 2020  ·  2Comentarios  ·  Fuente: tfutils/tfenv

Al navegar por el directorio con un archivo .terraform-version con este contenido: latest:^0.13 , no se instala automáticamente correctamente. En cambio, obtengo esto:

[mpescetto:~/test/test2]$ export TFENV_DEBUG=2
[mpescetto:~/test/test2]$ terraform -version
[DEBUG] Sourcing helpers from /usr/local/Cellar/tfenv/2.0.0/lib/helpers.sh
/usr/local/bin/terraform: DEBUG trap set
/usr/local/bin/terraform: Helpers sourced successfully
/usr/local/bin/terraform: $PATH does not contain '/usr/local/Cellar/tfenv/2.0.0/libexec', prepending and exporting it now
/usr/local/bin/terraform: $PATH does not contain '/usr/local/Cellar/tfenv/2.0.0/bin', prepending and exporting it now
/usr/local/bin/terraform: program="terraform"
/usr/local/bin/terraform: Exec: "/usr/local/Cellar/tfenv/2.0.0/bin/tfenv" exec "-version"
/usr/local/Cellar/tfenv/2.0.0/bin/tfenv: TFENV_HELPERS is set, not sourcing helpers again
/usr/local/Cellar/tfenv/2.0.0/bin/tfenv: $PATH already contains '/usr/local/Cellar/tfenv/2.0.0/libexec', not adding it again
/usr/local/Cellar/tfenv/2.0.0/bin/tfenv: $PATH already contains '/usr/local/Cellar/tfenv/2.0.0/bin', not adding it again
/usr/local/Cellar/tfenv/2.0.0/bin/tfenv: Setting TFENV_DIR to /Users/mpescetto/test/test2
/usr/local/Cellar/tfenv/2.0.0/bin/tfenv: tfenv argument is: exec
/usr/local/Cellar/tfenv/2.0.0/bin/tfenv: Long argument provided: exec
/usr/local/Cellar/tfenv/2.0.0/bin/tfenv: Resulting command-path: /usr/local/Cellar/tfenv/2.0.0/libexec/tfenv-exec
/usr/local/Cellar/tfenv/2.0.0/bin/tfenv: Exec: "/usr/local/Cellar/tfenv/2.0.0/libexec/tfenv-exec" "-version"
/usr/local/Cellar/tfenv/2.0.0/libexec/tfenv-exec: TFENV_HELPERS is set, not sourcing helpers again
/usr/local/Cellar/tfenv/2.0.0/libexec/tfenv-exec: $PATH already contains '/usr/local/Cellar/tfenv/2.0.0/libexec', not adding it again
/usr/local/Cellar/tfenv/2.0.0/libexec/tfenv-exec: $PATH already contains '/usr/local/Cellar/tfenv/2.0.0/bin', not adding it again
/usr/local/Cellar/tfenv/2.0.0/libexec/tfenv-exec: Getting version from tfenv-version-name
/usr/local/Cellar/tfenv/2.0.0/libexec/tfenv-version-name: TFENV_HELPERS is set, not sourcing helpers again
/usr/local/Cellar/tfenv/2.0.0/libexec/tfenv-version-name: $PATH already contains '/usr/local/Cellar/tfenv/2.0.0/libexec', not adding it again
/usr/local/Cellar/tfenv/2.0.0/libexec/tfenv-version-name: $PATH already contains '/usr/local/Cellar/tfenv/2.0.0/bin', not adding it again
/usr/local/Cellar/tfenv/2.0.0/libexec/tfenv-version-file: TFENV_HELPERS is set, not sourcing helpers again
/usr/local/Cellar/tfenv/2.0.0/libexec/tfenv-version-file: $PATH already contains '/usr/local/Cellar/tfenv/2.0.0/libexec', not adding it again
/usr/local/Cellar/tfenv/2.0.0/libexec/tfenv-version-file: $PATH already contains '/usr/local/Cellar/tfenv/2.0.0/bin', not adding it again
/usr/local/Cellar/tfenv/2.0.0/libexec/tfenv-version-file: Looking for a version file in /Users/mpescetto/test/test2
/usr/local/Cellar/tfenv/2.0.0/libexec/tfenv-version-file: Found at /Users/mpescetto/test/test2/.terraform-version
/usr/local/Cellar/tfenv/2.0.0/libexec/tfenv-version-name: TFENV_VERSION_FILE retrieved from tfenv-version-file: /Users/mpescetto/test/test2/.terraform-version
/usr/local/Cellar/tfenv/2.0.0/libexec/tfenv-version-name: TFENV_VERSION specified in TFENV_VERSION_FILE: latest:^0.13
/usr/local/Cellar/tfenv/2.0.0/libexec/tfenv-version-name: TFENV_VERSION uses 'latest' keyword: latest:^0.13
/usr/local/Cellar/tfenv/2.0.0/libexec/tfenv-version-name: 'latest' keyword uses regex: ^0.13
/usr/local/Cellar/tfenv/2.0.0/libexec/tfenv-version-name: No installed versions of terraform matched 'latest:^0.13'
Here's a shell for debugging the current environment. 'exit 0' to resume script from here. Non-zero exit code will abort - parent shell will terminate.

Incluso intentar listar con esto falla:

[mpescetto:~/test/test2]$ tfenv list
No installed versions of terraform matched 'latest:^0.13'
tfenv-version-name failed

pero si solo hago el tfenv install se instala correctamente:

[mpescetto:~/test/test2]$ tfenv install
Installing Terraform v0.13.4
Downloading release tarball from https://releases.hashicorp.com/terraform/0.13.4/terraform_0.13.4_darwin_amd64.zip
######################################################################## 100.0%
Downloading SHA hash file from https://releases.hashicorp.com/terraform/0.13.4/terraform_0.13.4_SHA256SUMS
No keybase install found, skipping OpenPGP signature verification
Archive:  tfenv_download.33M9Ak/terraform_0.13.4_darwin_amd64.zip
  inflating: /usr/local/Cellar/tfenv/2.0.0/versions/0.13.4/terraform
Installation of terraform v0.13.4 successful. To make this your default version, run 'tfenv use 0.13.4'

Así que no estoy seguro de por qué está fallando. Haré lo mejor en misterio para echarle un vistazo.

bug

Comentario más útil

Algo parece estar mal con la palabra clave "última".
Cuando intento reproducir su caso de uso, el resultado es diferente (porque también está instalado un 0.13.x)

❯ tfenv --version
tfenv 2.0.0-37-g0494129
❯ cat .terraform-version
latest:^0.13

Deje ver las versiones instaladas

❯ tfenv list
* 0.13.5 (set by /home/hugosalesses/workspace/private/terraform-examples/.terraform-version)
  0.12.30
  0.11.14

Hum! 0.13.5 es la última versión 0.13 instalada pero no la última 0.13 (0.13.6)
Y la ejecución de terraform muestra la misma versión incorrecta

❯ terraform version
Terraform v0.13.5

Your version of Terraform is out of date! The latest version
is 0.14.5. You can update by downloading from https://www.terraform.io/downloads.html

Creo que es necesario arreglar algo con la última palabra clave.

Todos 2 comentarios

Algo parece estar mal con la palabra clave "última".
Cuando intento reproducir su caso de uso, el resultado es diferente (porque también está instalado un 0.13.x)

❯ tfenv --version
tfenv 2.0.0-37-g0494129
❯ cat .terraform-version
latest:^0.13

Deje ver las versiones instaladas

❯ tfenv list
* 0.13.5 (set by /home/hugosalesses/workspace/private/terraform-examples/.terraform-version)
  0.12.30
  0.11.14

Hum! 0.13.5 es la última versión 0.13 instalada pero no la última 0.13 (0.13.6)
Y la ejecución de terraform muestra la misma versión incorrecta

❯ terraform version
Terraform v0.13.5

Your version of Terraform is out of date! The latest version
is 0.14.5. You can update by downloading from https://www.terraform.io/downloads.html

Creo que es necesario arreglar algo con la última palabra clave.

estoy de acuerdo
`` bash
$ TFENV_TERRAFORM_VERSION = más reciente: ^ 0.12 tfenv versión ejecutiva
Ninguna versión instalada de terraform coincidió con la 'última: ^ 0.12'
$ TFENV_TERRAFORM_VERSION = 0.12.30 tfenv versión ejecutiva
la versión '0.12.30' no está instalada (establecida por TFENV_TERRAFORM_VERSION). Instalando ahora como TFENV_AUTO_INSTALL == true
Instalación de Terraform v0.12.30
Descarga de la versión tarball de https://releases.hashicorp.com/terraform/0.12.30/terraform_0.12.30_linux_amd64.zip

################################################ ################ 100.0%

Descarga del archivo hash SHA de https://releases.hashicorp.com/terraform/0.12.30/terraform_0.12.30_SHA256SUMS
No se encontró la instalación de la base de claves, omitiendo la verificación de firma de OpenPGP
Archivo: tfenv_download.nwfk3i / terraform_0.12.30_linux_amd64.zip
inflado: /root/.tfenv/versions/0.12.30/terraform
Instalación de terraform v0.12.30 exitosa. Para que esta sea su versión predeterminada, ejecute 'tfenv use 0.12.30'
Terraform v0.12.30

¡Tu versión de Terraform está desactualizada! La última versión
es 0,14,9. Puede actualizar descargando desde https://www.terraform.io/downloads.html ''

¿Fue útil esta página
0 / 5 - 0 calificaciones