-
Couldn't load subscription status.
- Fork 902
Description
Is your feature request related to a problem? Please describe
I'm working with Terragrunt. It emits Terraform configuration and launches terraform to process it. The problem is that Terragrunt could be configured so that it emits Terraform configuration into a completely unrelated directory. For example:
home/
├─ steve/
│ ├─ tg/
│ │ ├─ database/
│ │ │ ├─ .tool-versions
│ │ │ ├─ terragrunt.hcl
│ │ │ ├─ main.tf
│ │ ├─ .tool-versions
│ │ ├─ root.hcl
│ ├─ .tg-work/
steve runs:
$ cd ~/tg/database
$ terragrunt --download-dir=$HOME/.tg-work init
Terragrunt emits Terraform configuration to a subdirectory inside /home/steve/.tg-work and launches terraform with working directory somewhere inside /home/steve/.tg-work/....
The result is that asdf doesn't see any .tool-versions files and exits with an error.
Describe the proposed solution
Introduce ASDF_TOOL_VERSIONS_DIR environment variable. If ASDF_TOOL_VERSIONS_DIR is set, asdf should begin searching for .tool-versions from ASDF_TOOL_VERSIONS_DIR instead of current directory.
Describe similar asdf features and why they are not sufficient
I don't know of any. Asdf starts its lookup only from current directory.
Describe other workarounds you've considered
I can set up Terragrunt hook that executes asdf current inside the original directory, uses awk to construct a .tool-versions file and puts it into a directory where the target Terraform configuration is going to reside. However, it adds a fragile step that depends on asdf current output format. It also doesn't seem to work on every target system we have.