Layout
Learn how Terraform project layout works and how you can structure the project files.
Terraform file
Until now, we have been creating several Terraform projects to get used to different concepts. In every project, though, we have been creating a single file called main.tf
where
we have placed all of our Terraform code (HCL). You may have wondered why all of the code was in a single file. Terraform actually does not care what the
file’s name is, as long as it ends in .tf
. So, in all of the projects thus far, we could have called the
file project.tf
, code.tf
, or foo.tf
. It really does not matter.
Terraform project folders
We can also split the code over as many files as we wish. The only rule is that all of the files have to be in the same folder since folders have significance in Terraform (as we will learn in the next ...