You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
This lesson walks you through installing Terraform, understanding the directory structure, configuring your first provider, and running the core workflow: init, plan, apply, and destroy.
brew tap hashicorp/tap
brew install hashicorp/tap/terraform
wget -O - https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
sudo apt update && sudo apt install terraform
choco install terraform
terraform version
# Terraform v1.x.x
A typical Terraform project looks like this:
my-project/
├── main.tf # Primary resource definitions
├── variables.tf # Input variable declarations
├── outputs.tf # Output value declarations
├── providers.tf # Provider configuration
├── terraform.tfvars # Variable values (often gitignored)
├── .terraform/ # Downloaded providers and modules (gitignored)
├── .terraform.lock.hcl # Dependency lock file (committed)
└── terraform.tfstate # State file (gitignored if using remote backend)
Tip: While you can put everything in a single
.tffile, splitting by concern (main.tf,variables.tf,outputs.tf) is a widely followed convention.
Subscribe to continue reading
Get full access to this lesson and all 10 lessons in this course.