Start here once you’ve finished the Terraform quickstart or the Pulumi quickstart. Everything below assumes you already have one working resource.
Terraform layout
Terraform reads every.tf file in a directory as one configuration, so file boundaries are for humans, not the tool. A layout that scales:
versions.tf:
main.tf stays just the provider block once credentials come from the environment (see Authentication):
variables.tf for anything that changes between runs or people:
outputs.tf for anything you or another tool needs after apply:
neolite.tf, storage.tf, baremetal.tf. Terraform does not care; your reviewers will.
.gitignore:
Pulumi layout
A Pulumi project is a regular program in your language, plus two files Pulumi itself reads:Pulumi.yaml:
index.ts into neolite.ts, storage.ts, and importing them back in, is a language convention, not a Pulumi requirement. Do it the same way you’d split any other program once it grows past what fits on one screen.
.gitignore for a TypeScript project:
venv//__pycache__/, Go’s build output, or your target language’s equivalent. Pulumi.yaml and every Pulumi.<stack>.yaml stay tracked.)
Naming things
Both providers share the terminology introduced on What is Infrastructure as Code?: resource names in code formatting,disk_size in Terraform vs diskSize in Pulumi. Carry that into your own names too:
- One resource block/declaration per real-world thing, named after what it is (
web, notresource1). - Keep the
-keysuffix convention for keypairs (web-key) so it reads clearly next to the VM it belongs to. - If the same repository holds application code as well, keep infrastructure in its own top-level
infra/folder next toapp/, rather than mixed into the app’s own directories.
Every code sample elsewhere in this documentation is written as a single flat file, because that reads best on a reference page. That’s a documentation choice, not a recommendation, once your own project is real.
Next steps
- Environments - the same layout, three different configurations for dev, staging, and production