The Project Structure docs explains how modules and stacks are generally defined in the
app folder. Modules and stacks can also be defined in the
vendor folder also. The vendor folder neatly organizes 3rd party vendor modules. Terraspace commands like terraspace build and terraspace up look for modules to build from both
Here’s an example with some modules in the vendor folder.
├── app │ └── modules │ └── instance └── vendor └── modules ├── database └── network
In this case, there are database and network 3rd parties modules. There’s also a normal project module called instance.
When there are 2 modules with the same name in both the
vendor/modules folder, the module in the
app/modules folder takes higher precedence and wins.
Eventually, terraspace builds all the modules to the
.terraspace-cache folder. Example:
.terraspace-cache/us-west-2/dev/modules/database .terraspace-cache/us-west-2/dev/modules/instance .terraspace-cache/us-west-2/dev/modules/network
The vendor additional lookup location can be particularly useful with modules declared in a Terrafile. You can add modules to your Terrafile definition and download them to the
vendor/modules folder with:
For more info, see the Terrafile docs.