How sidpalas/devops-directive-terraform-course works
Project type and purpose
• This is not a traditional “app” but a monorepo of Terraform tutorial code. It walks students from basic “hello-world” EC2 provisioning up through variable/outputs, modules, multi-environment management, testing, and CI/CD.
• The ultimate “system” it models is an end-to-end Infrastructure as Code pipeline: Developer → GitHub → Terraform (CLI/Cloud) → AWS (VPC, compute, storage, database, DNS) → Environments (dev/staging/prod) → Tests → CI/CD.
File structure
• Top-level:
• .github/workflows/terraform.yml (CI pipeline)
• Directories 01-09 corresponding to progressively advanced Terraform lessons
• Key directories:
• 03-basics/web-app → naive single-instance web app
• 04-variables-and-outputs/web-app → refactored web app with variables & outputs
• 06-organization-and-modules/web-app-module → reusable module defining compute.tf, database.tf, dns.tf, networking.tf, storage.tf
• 07-managing-multiple-environments → two patterns: folder structure per environment and Terraform workspaces
• 08-testing → bash tests, Terratest (Go), deployed environment examples
• 09-developer-workflows → GitHub Actions integration
• Configuration files:
• main.tf, variables.tf, outputs.tf in each example
• terraform.tfvars example files
• .github/workflows/terraform.yml for CI/CD
README for additional insights
• Each lesson’s README outlines its goal (evolution of IaC, basics, variables, modules, environments, testing, workflows).
a. Main components
• Developer Workstation (Terraform CLI)
• Source Control (GitHub repository)
• CI/CD (GitHub Actions)
• Terraform Cloud / Remote State Backend (or AWS S3 backend)
• Terraform Modules (web-app-module, consul module)
• AWS Infrastructure:
– VPC & networking
– EC2 Auto Scaling Group (compute.tf)
– Datastore (RDS or DynamoDB via database.tf)
– DNS (Route53 via dns.tf)
– Storage (S3 via storage.tf)
• Environments (dev, staging, production workspaces or folder deployments)
• Testing frameworks (Bash scripts, Terratest)
b. Relationships & interactions
1. Developer pushes code → GitHub
2. GitHub Actions triggers → runs terraform init/plan/apply
3. Terraform uses remote state backend (Terraform Cloud or S3)
4. Terraform calls modules (web-app-module, consul)
5. Modules create AWS resources
6. After apply, test suites run (bash scripts, Terratest)
7. Alerts or feedback loop back to GitHub/Slack (optional)
c. Architectural patterns & principles
• Infrastructure as Code (HCL)
• Module reusability & encapsulation (web-app-module, consul)
• Separation of environments via workspaces or directory structure
• Remote state management for collaboration
• Shift-left testing for infrastructure (unit testing modules, integration tests)
• GitOps/CI-driven deployments
d. Key technologies & frameworks
• Terraform (HCL, v0.12+)
• Terraform Cloud or AWS S3 as state backends
• AWS provider (EC2, RDS, VPC, S3, Route53)
• GitHub Actions for CI/CD
• Bash & Go (Terratest) for tests
• Modular directory layout (06-organization-and-modules)