Terraform from Zero to Advanced
Create and manage infrastructure as code: from your first terraform apply to modules, remote state, automated tests and deployments on AWS, Azure and Google Cloud. 20 labs based on the official documentation.
Beginner · 20 hours · 20 lessons · Course language: Spanish and English
A hands-on infrastructure-as-code course with Terraform 1.17. You start with your first project and the init, plan, apply and destroy cycle, and start a real web server with the Docker provider. You master variables, outputs, state, count and for_each, expressions and functions, data sources and the resource life cycle. You build your own modules, use modules from the Registry and organize projects with several environments. You keep the state in a remote backend with locking, use workspaces and refactor without destroying with moved, removed and import. You ensure quality with validations, check blocks and tests with terraform test and mocks. You finish by creating AWS resources (S3, DynamoDB and IAM) at no cost against a local emulator, testing Azure and Google Cloud configurations, automating with GitHub Actions and with a complete final project. Every command is explained and every result is real. The first 3 classes are free and include a video. The lessons, quizzes and videos are in English; the lab files keep their original Spanish names, and every lesson explains them.
What you will learn
- Write Terraform configurations and master the init, plan, apply and destroy cycle
- Use variables, outputs, locals, expressions, functions, count and for_each
- Understand and manage state: drift, remote backends, locking and workspaces
- Create reusable modules and use Registry modules with pinned versions
- Refactor without destroying infrastructure with moved, removed and import
- Ensure quality with validations, check blocks and tests with terraform test
- Create infrastructure on AWS and prepare configurations for Azure and Google Cloud
- Automate plan and apply with GitHub Actions
Skills
Terraform, Infrastructure as code, HCL, Terraform state, Modules, Remote backends, terraform test, AWS, Azure, Google Cloud, GitHub Actions
Program
Module 1: First steps (free classes)
Infrastructure as code, your first project, providers and variables.
Project: An nginx web server in Docker created and destroyed with Terraform.
- Infrastructure as code and your first Terraform: What IaC is, how Terraform works, HCL and the init, plan, apply and destroy cycle.
- Providers and resources: a web server with Docker: Providers, the lock file, resources and references: nginx in Docker with Terraform.
- Variables, outputs and .tfvars files: Parameterize your configuration: types, defaults, tfvars, environment variables and outputs.
Module 2: Fundamentals
State, count and for_each, expressions and functions, data sources and lifecycle.
Project: Several websites created from a configuration map.
- Terraform state: What terraform.tfstate stores, state list and show, drift and refresh-only mode.
- count, for_each and dependencies: Many resources from a list or a map, implicit dependencies and depends_on.
- Expressions, functions and terraform console: locals, conditionals, for expressions, string and collection functions, and templatefile.
- Data sources and the resource life cycle: Read existing information and control replacements with lifecycle.
Module 3: Modules
Your own modules, Registry modules, versions and projects with several environments.
Project: A website module used in the dev and prod environments.
- Your first module: A module's variables and outputs, calling it several times and the standard structure.
- Registry modules and versions: Version constraints, the lock file, init -upgrade and a public module.
- Projects with several environments: Folders per environment, shared modules and different values for dev and prod.
Module 4: Advanced state
Remote backends with locking, workspaces and refactoring without destroying.
Project: The team's state in PostgreSQL and imported, reorganized resources.
- Remote backends and state locking: The team's state in PostgreSQL and S3, locking and migration with init -migrate-state.
- Workspaces: Several states for one configuration and terraform.workspace.
- Refactoring without destroying: moved, removed and import: Rename, stop managing and import resources without recreating them.
Module 5: Quality and security
Validations, check blocks, tests with terraform test, sensitive and ephemeral values.
Project: A module with validations and a suite of automated tests.
- Validations, preconditions and check blocks: Rules for variables, conditions before and after creating, and continuous checks.
- Testing with terraform test: .tftest.hcl files, plan and apply in tests, expect_failures and mock providers.
- Dynamic blocks, sensitive and ephemeral values: dynamic, sensitive, ephemeral values and how not to leak secrets into the state.
Module 6: Cloud and production
AWS, Azure and Google Cloud, CI/CD with GitHub Actions and a final project.
Project: A complete application with modules, remote state, tests and CI.
- AWS with Terraform: S3, DynamoDB and IAM: The AWS provider against a local emulator, and how to point it at your real account.
- Azure and Google Cloud: The azurerm and google providers, authentication and tests without credentials using mocks.
- CI/CD with GitHub Actions: fmt, validate, test and plan on every pull request, and apply with OIDC on merge.
- Final project: a complete application with Terraform: Network, database, API and proxy with modules, remote state, validations and tests.
Prerequisites
- A Windows, macOS or Linux computer with 8 GB of RAM
- Docker Desktop installed (we use it to create real infrastructure at no cost; you can learn it for free in our Docker from Scratch course)
- Basic use of the terminal. You don't need a cloud account: AWS is emulated on your computer
Next courses
- Monitoring with Prometheus and Grafana · Beginner · 20 hours
Measure your servers and applications, build professional dashboards and get alerts before your users notice a problem. 20 labs with Prometheus 3 and Grafana 13, based on the official documentation. - Docker from Scratch: Containers, Images and Docker Compose · Beginner · 20 hours · Free course
A free, 100% hands-on course: run containers, build your own images with a Dockerfile, keep data in volumes, connect services on networks and start complete applications with Docker Compose in 20 labs.