Course outlines for learning terraform.
expected time | requirements |
---|---|
30 minutes | a computer |
Goal: Understand how to best organize Terraform repositories.
The files you place in a repository can be split up. Hashicorp documents this, here is a summary.
.
├── examples
│ └── default # <- You can have other scenarios as well.
│ └── main.tf # <- This is a root-module, using this module.
├── LICENSE
├── locals.tf # <- Here is where you store "logic".
├── main.tf # <- Here is where you store "logic".
├── outputs.tf # <- The output is described here.
├── providers.tf # <- Provider configuration in here.
├── README.md
├── variables.tf # <- The input is described here.
└── versions.tf # <- Uses providers/modules go heere.
You could also introduce a providers.tf
to split provider specific details in.
The intent of the splitting is that you and others can easily find how to use the role.
Some repositories have quite a large main.tf
. In some cases you will see the main.tf
split up in logical chunks, like:
network.tf
.firewall.tf
.instances.tf
.inputs.tf
instead of variables.tf
?