Terraform Made Simple: Day 0 - FOUNDATION
Let's lay the foundation: What is Terraform, why use it, and how does it work?
1. What is Terraform?
➔ It is an Infrastructure as Code (IaC) tool created by HashiCorp.
➔ It uses a declarative configuration language (HCL). This means you simply define the goal (what you want to build), and Terraform figures out the steps to get there.
➔ It actively manages the full lifecycle of your resources from creation to destruction.
2. Why do we use it?
➔ Speed & Repeatability: Instead of manually clicking through cloud consoles, you can spin up identical, error-free environments (Dev, Staging, Prod) in minutes using the same code.
➔ Version Control & Collaboration: Because your infrastructure is just text files, you can store it in Git. Teams can track history, review changes via Pull Requests, and instantly roll back mistakes.
➔ State Management & Locking: Terraform keeps a State file, which is a memory of exactly what it has built. It locks this file during updates so two engineers don't accidentally overwrite each other's work at the same time.
➔ Cloud Agnostic (No Lock-in): Unlike AWS CloudFormation, Terraform works with almost every provider (AWS, Azure, GCP, Kubernetes, etc.) using the exact same workflow.
➔ Prevents Configuration Drift: If someone logs into the console and manually changes a server, the next Terraform run will detect the discrepancy and revert it back to match your code's desired state.
3. The Execution Flow:
➔ Terraform CLI: Reads your .tf files, validates your syntax, and builds an execution plan.
➔ Terraform Provider: The translator. It takes your generalized configuration and translates it into specific API calls (e.g., AWS, Azure, or Google Cloud APIs).
➔ The Cloud: Receives those API calls to seamlessly create, update, and manage your actual infrastructure.
That’s a wrap for Day 0! 🎬 Tomorrow, we dive into the Terraform Language, starting with the Terraform Block.
Drop a follow to stay updated with the series!
Comments
Post a Comment