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.

Get hands-on with 1200+ tech skills courses.