`terraform get` usage information still mentions the removed "PATH" argument
Terraform Version
The issue is present on both 0.15 and 1.0.
$ terraform version
Terraform v1.0.5
on darwin_amd64
$ terraform version
Terraform v0.15.5
on darwin_amd64
Expected Behavior
terraform get PATH should download and install modules needed for the configuration given by PATH.
Actual Behavior
$ terraform get some-dir
Too many command line arguments. Did you mean to use -chdir?
Steps to Reproduce
See above.
Additional Context
terraform get --help
Usage: terraform [global options] get [options] PATH
...
When looking at the help message then it looks like that the PATH argument should be respected, but instead you get an error to use -chdir option.
Do note that doing terraform get some-dir with terraform0.14 vs terraform -chdir=some-dir get with terraform0.15 has completely different behaviour.
With terraform0.14 the modules are downloaded to .terraform in the current working directory e.g
$ terraform get some-dir
$ ls -a
. .. .terraform some-dir
With terraform0.15/1.0 it changes the directory and creates the .terraform directory in the dir specified by -chdir option e.g:
$ terraform -chdir=some-dir
$ tree -a
.
└── some-dir
├── .terraform
│ └── modules
│ └── modules.json
└── main.tf
Hi @manfredlift! Thanks for reporting this.
The bug here is in the usage information, not in the behavior. Modern Terraform no longer has the often-problematic and inconsistently-implemented positional arguments for selecting a configuration directory, and instead has the generally-available -chdir option.
You can read more details about this in the relevant upgrade guide section, which includes information on how you can use the TF_DATA_DIR environment variable in combination with the -chdir option in order to retain unusual situations like the one you described here, where you place the .terraform directory in a different location than in the selected directory. Note however that Terraform does not expect two different configurations to be sharing the same data directory, so you may encounter unusual misbehavior (either in current or future Terraform versions) if you don't ensure that each configuration has its own separate data directory.
With that said then, we'll use this issue to represent updating the usage information to no longer incorrectly mention the unsupported "PATH" argument.
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.