i am organizing my .tf files trying to find a way to scan .tf under deeper folders
i think this is a pretty common use case so not sure if i am missing something, i noticed the [dir] argument but i am trying to see if i can pass at least multiple directories as arguments
any hints?
I am having a script that looks like this so far
#!/usr/bin/env bash
terraform plan \
ecs
output
providers
registry
security
-var-file="secret_vars.tfvars" \
-var-file="ecs/public_vars.tfvars"
UPDATE but not sure if it is working so far
Hi @cordoval! Currently this isn't supported - though you may be able to make use of the module system to organise your code in the manner you'd like?
@jen20 the problem with modules is that they require to be pulled out from the web or registries, i don't like that, i want everything in subfolders.
They don't need to be pulled out of the web or registries: you can specify the source as a subdirectory of the file system - for example:
module "iam" {
source = "${path.module}/modules/iam"
}
Does that make them more palatable?
you rock @jen20
it still stores them with terraform get into under .terraform/modules right? so i always have to run terraform get whenever i do any change in them
Hi @cordoval, actually no you don't need to run terraform get unless you add a new module, or you have a fresh clone of the repository. This is because terraform get uses symlinks in the .terraform/modules directory:
.
โโโ .terraform
โย ย โโโ modules
โย ย โโโ de20b4a64fe2fcc6b3b57b2c0e1e2b01 -> /Users/James/Code/terraform/mods/module
โโโ main.tf
โโโ module
โย ย โโโ main.tf
Hopefully this provides a solution - feel free to reopen if not!
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.
Most helpful comment
Hi @cordoval, actually no you don't need to run
terraform getunless you add a new module, or you have a fresh clone of the repository. This is becauseterraform getuses symlinks in the.terraform/modulesdirectory:Hopefully this provides a solution - feel free to reopen if not!