# Terraform

Describe infrastructure in code, review it in a PR, and apply it the same way every time.

Level: Intermediate. Free on DevOps Academy: https://devops.rajeev.pro/courses/terraform

## Roadmap

1. **Introduction**: Why clicking in the console doesn't scale. [Lesson](https://devops.rajeev.pro/courses/terraform/01-infrastructure-as-code)
   Topics: Infrastructure as code; What Terraform is; Use cases; IaC vs config management; Installing
2. **HCL**: The language every Terraform file is written in. [Lesson](https://devops.rajeev.pro/courses/terraform/02-hcl)
   Topics: Syntax; Blocks & arguments; Types & expressions
3. **Providers**: How Terraform talks to AWS, GitHub, Cloudflare and the rest. [Lesson](https://devops.rajeev.pro/courses/terraform/03-providers)
   Topics: Terraform Registry; Configuring providers; Version pinning
4. **Project initialization**: Set up a working directory the right way. [Lesson](https://devops.rajeev.pro/courses/terraform/04-project-initialization)
   Topics: terraform init; Lock file
5. **Resources**: The things you actually create, and how Terraform decides to change them. [Lesson](https://devops.rajeev.pro/courses/terraform/05-resources)
   Topics: Resource behaviour; Lifecycle; count & for_each; depends_on
6. **Variables & outputs**: Make one config work for many environments. [Lesson](https://devops.rajeev.pro/courses/terraform/06-variables-outputs)
   Topics: Input variables; .tfvars files; Locals; Outputs; Preconditions
7. **Format & validate**: Cheap checks that catch mistakes before plan. [Lesson](https://devops.rajeev.pro/courses/terraform/07-format-validate)
   Topics: terraform fmt; terraform validate; TFLint
8. **State**: The most important and most dangerous part of Terraform. [Lesson](https://devops.rajeev.pro/courses/terraform/08-state)
   Topics: What state is; Remote state & locking; State best practices; state mv & import
9. **Plan, apply, destroy**: The everyday loop. Always read the plan. [Lesson](https://devops.rajeev.pro/courses/terraform/09-plan-apply-destroy)
   Topics: terraform plan; terraform apply; terraform destroy
10. **Modules**: Reuse good infrastructure instead of copy-pasting it. [Lesson](https://devops.rajeev.pro/courses/terraform/10-modules)
   Topics: Root vs child modules; Inputs & outputs; Registry modules; Versioning
11. **Data sources & templates**: Read existing infrastructure and render config files. [Lesson](https://devops.rajeev.pro/courses/terraform/11-data-sources-templates)
   Topics: Data sources; templatefile(); Provisioners (and why to avoid them)
12. **Environments**: Keep dev, staging and prod separate and safe. [Lesson](https://devops.rajeev.pro/courses/terraform/12-environments)
   Topics: Workspaces; Folder per environment
13. **CI/CD integration**: Plan on every PR, apply on merge. No more laptop applies. [Lesson](https://devops.rajeev.pro/courses/terraform/13-ci-cd-integration)
   Topics: GitHub Actions; GitLab CI; Jenkins; Plan on PR, apply on merge
14. **Testing**: Prove a module works before others depend on it. [Lesson](https://devops.rajeev.pro/courses/terraform/14-testing)
   Topics: terraform test; Integration tests; Terratest
15. **Scaling Terraform**: What changes when there are hundreds of resources and many teams. [Lesson](https://devops.rajeev.pro/courses/terraform/15-scaling-terraform)
   Topics: Splitting state; Terragrunt; Infracost
16. **Security**: Keep secrets out of state and catch risky changes early. [Lesson](https://devops.rajeev.pro/courses/terraform/16-security)
   Topics: Secret management; Policy as code (OPA, Sentinel); Checkov & tfsec
17. **Capstone project**: Build real AWS infrastructure end to end, with a free track that needs no AWS account. [Lesson](https://devops.rajeev.pro/courses/terraform/17-capstone-aws-infrastructure)
   Topics: VPC & networking; Load balancer & Auto Scaling; Remote state & environments; Free and cloud tracks; Cleanup
