Hey Terraform community,
As I’m new to terraform and we are still figuring out how to structure our infrastructure code, there is a question i didn’t find an answer to.
We are using the following directory structure for our code:
environment
—test
-----subgroup(describes part of Test stage)
--------terraform.tfvars (declaring values to use in modules)
--------terraform.tf (referencing our modules)
—prod
-----subgroup
-------…
modules
—modulename
-----modulename.tf
-----input.tf (for variable definition)
-----output.tf (output definition
All of this is planned to use a remote state in an Azure Storage Account.
Our question is: where and how do we use “terraform init” in this setup. Because my understanding was, that its run once in a directory where the terraform.tf file is (like in the environments subdirectories).
Is there any other way to not initialize each subdirectory for using our modules? Or did i got the whole structure wrong?
Greetings Fabian