Lesson 1 of 4 ยท Terraform Core Concepts
Configuration structure
Terraform reads all .tf files in one folder as a single configuration. Split a growing configuration by purpose rather than by command: providers, variables, resources, and outputs are common starting points. The filenames are for people; Terraform does not require a particular naming scheme.
Example
# providers.tf
provider "aws" {
region = var.region
}
# variables.tf
variable "region" {
type = string
}Step by step
- Keep related declarations together.
- Use clear names such as providers.tf and outputs.tf.
- Keep one environment or reusable module in a deliberate folder.
- Format before sharing the configuration.
Common mistakes to avoid
- Assuming Terraform runs files alphabetically.
- Scattering one resource across many files without a reason.