Skip to content

Terraform & IaC

Terraform tutorials — HCL, providers, state, modules, workspaces, dynamic blocks, and infrastructure as code patterns

88 Published

In this tutorial, you will learn about Terraform. We cover key concepts, practical examples, and best practices to help you master this topic.

Comprehensive terraform tutorials covering everything from qubits and Superposition to advanced algorithms and real-world applications.

Fundamentals

Terraform vs Ansible vs CloudFormation vs Pulumi: IaC Tools Compared
Terraform Directory Structure: Organizing Environments, Modules, and Backend Configs
Terraform CLI Commands: Essential Command Reference for DevOps Engineers
Terraform Configuration Files: .tf, .tfvars, .terraform.lock.hcl Explained
Terraform Backend Types: Local, Remote, and Cloud Backend Configurations
Terraform Destroy: Safe Resource Deletion and Protection Strategies
Terraform Validate and Format: Code Quality Tools and Workflow Integration
Terraform Console: Interactive Debugging and Expression Evaluation Guide
Terraform Graph: Visualizing Resource Dependencies and Infrastructure Architecture
Terraform Lock File: Managing Provider Versions with .terraform.lock.hcl

Career & Learning

Terraform Associate Certification: Complete Exam Guide and Study Resources
Terraform Learning Path: Roadmap from Beginner to Production Expert
Terraform Interview Questions: Top Questions for DevOps and Cloud Engineer Roles
Terraform Portfolio Projects: Building Real-World IaC for Your Resume
Terraform Production Deployment Tips: Lessons from Real-World Infrastructure Teams

Additional Classic Tutorials

Terraform Dynamic Blocks, Count & For Each
Terraform Built-in Functions: Format, Merge, File & More
HCL Syntax: Terraform Configuration Language Guide
Terraform Modules: Reusable Infrastructure Components
Terraform Providers: AWS, Azure, GCP Provider Configuration
Terraform Remote Backends: S3, Terraform Cloud & More
Terraform Resources & Data Sources: Managing Infrastructure
Terraform State: Remote State, Locking & Backends
Terraform on AWS -- Complete Guide to Provisioning AWS Infrastructure
Terraform on Azure -- Complete Guide to Provisioning Azure Infrastructure
Terraform Best Practices and Patterns: Production-Grade Infrastructure Code
Terraform in CI/CD Pipelines: GitHub Actions, GitLab CI & Terraform Cloud
Terraform on GCP -- Complete Guide to Provisioning Google Cloud Infrastructure
Terraform Import: Managing Existing Infrastructure with IaC
Install Terraform: CLI Setup Guide for Linux, macOS & Windows
Building Terraform Modules: Reusable Infrastructure Components
Multi-Cloud Terraform: AWS, Azure & GCP
Terraform Overview: What Is Infrastructure as Code?
Terraform Plan & Apply: Deployment Workflow
Terraform Production Best Practices & Patterns
Remote State with S3 and DynamoDB: Terraform State Backend Deep Dive
Terraform Security: Secrets, Policies & Sentinel
Terraform State Management: Remote Storage, Locking & Migration
Testing Terraform Configurations: Validate, TFLint, TFSec, Terratest & Unit Tests
Terraform Troubleshooting: Common Errors & Solutions
Terraform Workspaces and Environments: Multi-Environment Infrastructure
Terraform Variables, Locals & Outputs: Dynamic Configurations
Terraform Workspaces: Multi-Environment Deployments -- Complete Guide

Published Topics

Workspaces

✓ Live

Terraform Overview: What Is Infrastructure as Code?

Learn Terraform and Infrastructure as Code: how declarative configuration files replace manual infrastructure management, enabling automated, version-controlled, and repeatable deployments across cloud providers.

✓ Live

Install Terraform: CLI Setup Guide for Linux, macOS & Windows

Learn how to install Terraform on Linux, macOS, and Windows using package managers and manual methods, plus verify the installation and configure your first provider.

✓ Live

HCL Syntax: Terraform Configuration Language Guide

Learn HashiCorp Configuration Language (HCL): blocks, arguments, identifiers, expressions, heredocs, and comments used to define Terraform infrastructure as code configurations.

✓ Live

Terraform Providers: AWS, Azure, GCP Provider Configuration

Learn Terraform providers: how to configure AWS, Azure, and GCP providers, manage provider versions, use multiple providers, and authenticate securely with cloud platforms.

✓ Live

Terraform Resources & Data Sources: Managing Infrastructure

Learn Terraform resources and data sources: how to define infrastructure components, reference resource attributes, query existing infrastructure, and manage resource dependencies and lifecycle.

✓ Live

Terraform Variables, Locals & Outputs: Dynamic Configurations

Learn Terraform variables, local values, and outputs: how to parameterize configurations, reduce duplication with locals, and expose infrastructure attributes for consumption.

✓ Live

Terraform State: Remote State, Locking & Backends

Learn Terraform state management: how state files track infrastructure, why remote state with locking is essential for teams, and how to configure backends for production use.

✓ Live

Terraform Modules: Reusable Infrastructure Components

Learn Terraform modules: how to create reusable infrastructure components, publish modules, pass variables between modules, and compose modules to build complex architectures.

✓ Live

Terraform Plan & Apply: Deployment Workflow

Learn the Terraform plan and apply workflow: how to preview infrastructure changes, apply configurations safely, understand the execution plan, and handle errors during deployment.

✓ Live

Terraform Remote Backends: S3, Terraform Cloud & More

Learn Terraform remote backends: how to configure S3 with DynamoDB locking, Terraform Cloud, Azure Storage, and GCS backends for secure team-based state management.

✓ Live

Terraform Dynamic Blocks, Count & For Each

Learn Terraform dynamic blocks, count, and for_each: how to create multiple resources dynamically, iterate over collections, and write flexible, DRY infrastructure configurations.

✓ Live

Terraform Built-in Functions: Format, Merge, File & More

Learn Terraform built-in functions: string manipulation with format and join, collection operations with merge and flatten, file reading, type conversion, and numeric functions for dynamic configurations.

✓ Live

Terraform Import: Managing Existing Infrastructure with IaC

Learn Terraform import: how to bring existing cloud resources under Terraform management, generate configuration from state, and import resources at scale using import blocks.

✓ Live

Terraform Security: Secrets, Policies & Sentinel

Learn Terraform security: how to manage secrets with Vault and environment variables, enforce policies with Sentinel, scan for misconfigurations, and implement least-privilege IAM roles.

✓ Live

Multi-Cloud Terraform: AWS, Azure & GCP

Learn multi-cloud Terraform: how to manage AWS, Azure, and GCP infrastructure from a single configuration, share data between providers, and build cloud-agnostic modules.

✓ Live

Terraform Production Best Practices & Patterns

Learn Terraform production best practices: state isolation, module design patterns, code review workflows, cost management, team collaboration, and operational excellence for IaC at scale.

✓ Live

Terraform Troubleshooting: Common Errors & Solutions

Learn how to troubleshoot common Terraform errors: state lock issues, provider authentication failures, resource conflicts, dependency cycles, and plan apply mismatches with proven solutions.

✓ Live

Terraform State Management: Remote Storage, Locking & Migration

Learn Terraform state management in depth: how to configure remote backends with S3 and DynamoDB, implement state locking, migrate state safely, recover from corruption, and structure state for team-scale infrastructure.

✓ Live

Building Terraform Modules: Reusable Infrastructure Components

Learn how to build Terraform modules: design module structure with inputs and outputs, use version constraints, publish to registries, compose modules into architectures, and follow production-grade patterns for reusability.

✓ Live

Terraform on AWS -- Complete Guide to Provisioning AWS Infrastructure

Learn how to use Terraform on AWS: provision EC2 instances, VPCs, S3 buckets, RDS databases, IAM roles, and Lambda functions with Infrastructure as Code, including provider configuration, state management, and security best practices.

✓ Live

Terraform on Azure -- Complete Guide to Provisioning Azure Infrastructure

Learn how to use Terraform on Azure: provision virtual networks, VMs, Azure SQL databases, storage accounts, AKS clusters, and IAM roles with Infrastructure as Code, including AzureRM provider configuration and security best practices.

✓ Live

Terraform on GCP -- Complete Guide to Provisioning Google Cloud Infrastructure

Learn how to use Terraform on Google Cloud: provision GCE instances, VPC networks, Cloud Storage buckets, Cloud SQL databases, GKE clusters, and IAM policies with Infrastructure as Code, including provider configuration and security patterns.

✓ Live

Remote State with S3 and DynamoDB: Terraform State Backend Deep Dive

Learn how to configure Terraform remote state with S3 and DynamoDB: set up encrypted state storage, implement DynamoDB state locking, manage multiple state files, and build a production-grade state infrastructure for teams.

✓ Live

Terraform in CI/CD Pipelines: GitHub Actions, GitLab CI & Terraform Cloud

Learn how to run Terraform in CI/CD pipelines: implement plan-only PR checks, automated apply on merge, approval gates for production, state isolation, OIDC authentication, and multi-environment deployment workflows.

✓ Live

Terraform Workspaces and Environments: Multi-Environment Infrastructure

Learn Terraform workspaces and environment management: how to use workspaces for dev, staging, and production isolation, implement workspace-aware configurations, compare workspaces vs directory structure, and build multi-environment deployment strategies.

✓ Live

Testing Terraform Configurations: Validate, TFLint, TFSec, Terratest & Unit Tests

Learn how to test Terraform configurations: validate syntax, format code, lint with TFLint, scan security with TFSec, write unit tests with the terraform test framework, and integration test with Terratest for production confidence.

✓ Live

Terraform Best Practices and Patterns: Production-Grade Infrastructure Code

Learn Terraform best practices and patterns: state isolation, module design, naming conventions, security controls, cost management, team workflows, code review processes, and operational patterns for managing infrastructure as code at scale.

✓ Live

Terraform vs Ansible vs CloudFormation vs Pulumi: IaC Tools Compared

Learn the key differences between Terraform, Ansible, CloudFormation, and Pulumi to choose the right infrastructure as code tool for your DevOps workflow.

✓ Live

Terraform Directory Structure: Organizing Environments, Modules, and Backend Configs

Learn how to structure Terraform projects with proper directory layouts for environments, modules, state backends, and variable files in production deployments.

✓ Live

Terraform CLI Commands: Essential Command Reference for DevOps Engineers

Learn the essential Terraform CLI commands every DevOps engineer needs: init, plan, apply, destroy, fmt, validate, state, workspace, and import with examples.

✓ Live

Terraform Configuration Files: .tf, .tfvars, .terraform.lock.hcl Explained

Learn the purpose and syntax of every Terraform file type: .tf for resources, .tfvars for variables, and .terraform.lock.hcl for provider version pinning.

✓ Live

Terraform Backend Types: Local, Remote, and Cloud Backend Configurations

Learn the differences between Terraform backend types: local vs remote (S3, GCS, Azure, Terraform Cloud), and which backend suits your team and workflow.

✓ Live

Terraform Destroy: Safe Resource Deletion and Protection Strategies

Learn safe Terraform destroy strategies: using prevent_destroy, deletion_protection, target flags, and state surgery to delete infrastructure without accidents.

✓ Live

Terraform Validate and Format: Code Quality Tools and Workflow Integration

Learn how to enforce Terraform code quality with terraform fmt, validate, tflint, and pre-commit hooks integrated into your CI pipeline for clean IaC.

✓ Live

Terraform Console: Interactive Debugging and Expression Evaluation Guide

Learn terraform console for debugging: test expressions, inspect resource attributes, evaluate functions, and troubleshoot configurations in real time.

✓ Live

Terraform Graph: Visualizing Resource Dependencies and Infrastructure Architecture

Learn to use terraform graph to visualize infrastructure as a directed acyclic graph, understand resource dependencies, and optimize deployment ordering.

✓ Live

Terraform Lock File: Managing Provider Versions with .terraform.lock.hcl

Learn how the Terraform lock file pins provider versions for reproducible builds, how to update it safely, and how to resolve checksum mismatch errors.

✓ Live

Terraform State File: Structure, Security Risks, and Protection Best Practices

Learn what the Terraform state file contains, why it may hold sensitive data, and how to encrypt, isolate, and secure state files in production environments.

✓ Live

Terraform State Locking: DynamoDB Backend for Concurrent Access Control

Learn how DynamoDB state locking prevents concurrent Terraform runs, configure the locks table, handle stale locks, and force-unlock safely for team workflows.

✓ Live

Terraform State Migration: Moving State Between Backends and Workspaces

Learn how to migrate Terraform state between backends (local to S3, S3 to Terraform Cloud), between workspaces, and across AWS accounts with zero downtime.

✓ Live

Terraform State Commands: List, Show, MV, RM, Pull, and Push Operations

Learn Terraform state commands: state list, state show for inspection, state mv for refactoring, state rm for removal, and pull and push for safe backups.

✓ Live

Terraform Cloud Backend: Remote State, Runs, and Team Collaboration

Learn how the Terraform Cloud backend enables remote state, remote operations, team collaboration with run queues, and VCS-driven infrastructure workflows.

✓ Live

Terraform Remote State Data Sources: Sharing Outputs Across Workspaces

Learn how to use the terraform_remote_state data source to read outputs from other workspaces for cross-stack infrastructure reference across environments.

✓ Live

Terraform State Backup and Recovery: Disaster Recovery for State Files

Learn Terraform state backup and disaster recovery: automated backups, point-in-time recovery, state versioning, and recovering from corruption or deletion.

✓ Live

Terraform Partial Backend Configuration: Using -backend-config for Dynamic Backends

Learn how to use partial backend configuration with -backend-config flags to dynamically set S3 bucket, key, and DynamoDB table per environment at init.

✓ Live

Terraform Module Registry: Finding, Using, and Publishing Community Modules

Learn how to find and use modules from the Terraform Registry, understand versioning and documentation, and publish your own modules for the community.

✓ Live

Terraform Module Versioning: Semantic Versioning and Version Constraints

Learn how module versioning works in Terraform: semantic version tags, version constraint operators (~>, >=, <=), and strategies for safe module upgrades.

✓ Live

Terraform Module Sources: GitHub, S3, HTTP, Terraform Registry, and Local Paths

Learn Terraform module source types: local paths for monorepos, GitHub for private repos, S3 for artifact storage, and the Registry for public modules.

✓ Live

Terraform Module Composition: Nesting Modules and Sharing Outputs Between Modules

Learn how to compose Terraform modules by nesting, passing outputs across modules, and building layered infrastructure abstractions for complex deployments.

✓ Live

Terraform Module for_each and count: Creating Multiple Module Instances Dynamically

Learn to create multiple module instances using for_each and count, iterate over maps and lists, and manage dynamic infrastructure at the module level.

✓ Live

Terraform Module Testing: Terratest and kitchen-terraform for Infrastructure Testing

Learn how to test Terraform modules using Terratest (Go) and kitchen-terraform (Ruby): unit tests, integration tests, and infrastructure output validation.

✓ Live

Terraform Module Dependencies: depends_on and Output-Based Ordering

Learn how to manage module dependencies in Terraform with implicit output references, explicit depends_on, and strategies for controlling module ordering.

✓ Live

Terraform Module Best Practices: Input Validation, Outputs, and Documentation

Learn Terraform module best practices: input variable validation, useful output design, README documentation, and reusable patterns for production modules.

✓ Live

Terraform Provider Versioning: Constraints, Upgrades, and Lock File Management

Learn how Terraform provider versioning works: required_providers blocks, version constraints, safe upgrades, and managing the lock file across your team.

✓ Live

Terraform Provider Development: Building Custom Providers in Go

Learn how to build a custom Terraform provider in Go: define resources and data sources, implement CRUD operations, and publish providers for internal tools.

✓ Live

Terraform Resource Lifecycle: create_before_destroy, prevent_destroy, and ignore_changes

Learn Terraform lifecycle meta-arguments: create_before_destroy for zero-downtime, prevent_destroy for safety, and ignore_changes for external updates.

✓ Live

Terraform Provider Aliases: Multi-Region and Multi-Account Provider Configurations

Learn to configure Terraform provider aliases for multi-region and multi-account deployments, managing multiple provider instances in one configuration.

✓ Live

Terraform Data Sources: Fetching External Data for Dynamic Configuration

Learn how Terraform data sources fetch external information like AMI IDs, availability zones, and existing resources to configure infrastructure dynamically.

✓ Live

Terraform Resource Behavior: Understanding CRUD Operations and Terraform Graph

Learn how Terraform maps resource blocks to cloud provider CRUD operations, how the dependency graph determines creation order, and how to plan for changes.

✓ Live

Terraform Multiple Providers: Configuring AWS, Azure, and GCP in One Project

Learn to configure multiple cloud providers (AWS, Azure, GCP) in a single Terraform project with proper provider aliases, regions, and resource targeting.

✓ Live

Terraform Resource Targeting: Using -target Flag for Selective Operations

Learn how to use the terraform -target flag for selective plan and apply on specific resources, and understand the risks of partial infrastructure updates.

✓ Live

Terraform with GitHub Actions: Automated Plan and Apply Pipeline

Learn how to build a complete Terraform CI/CD pipeline with GitHub Actions: automated plan on PRs, apply on merge, state locking, and approval gate workflows.

✓ Live

Terraform with GitLab CI: Infrastructure Pipeline Templates and Best Practices

Learn how to set up Terraform pipelines in GitLab CI with merge request plans, manual apply jobs, state caching, and multi-environment deployment stages.

✓ Live

Terraform Atlantis: Pull Request Automation for Team Infrastructure Reviews

Learn how Atlantis automates Terraform workflows via pull requests: automated plan comments, apply approvals, policy checks, and multi-repo management.

✓ Live

Terraform with Jenkins: Pipeline as Code for Infrastructure Deployments

Learn how to build Terraform Jenkins pipelines with declarative syntax, automated plan and apply stages, credential management, and artifact archiving.

✓ Live

Terraform Drift Detection: Automated State and Infrastructure Comparison

Learn how to detect Terraform state drift using plan commands in CI pipelines, scheduled detection jobs, and tools like driftctl to catch manual changes.

✓ Live

Terraform Automation Scripts: Running Terraform in Shell Scripts and Cron Jobs

Learn how to run Terraform in shell scripts and cron jobs with error handling, workspace selection, variable passing, and logging for unattended automation.

✓ Live

Terraform Cloud CLI: Remote Runs, VCS Integration, and API-Driven Workflows

Learn how the Terraform Cloud CLI integrates local development with remote execution: remote plan and apply, VCS-driven runs, API tokens, and team workflows.

✓ Live

Terraform Cost Estimation in CI: Infracost and Budget Validation Gates

Learn how to estimate Terraform infrastructure costs in CI pipelines using Infracost, set budget thresholds, and add cost validation gates before apply.

✓ Live

Terraform Secrets Management: Vault, AWS Secrets Manager, and SOPS Integration

Learn how to manage Terraform secrets: HashiCorp Vault, AWS Secrets Manager, and SOPS for secure variable injection without exposing sensitive values.

✓ Live

Terraform Policy as Code: Sentinel Policies for Compliance and Governance

Learn Terraform policy as code with Sentinel: enforce tagging rules, instance types, region restrictions, and compliance standards across team deployments.

✓ Live

Terraform State Encryption: Protecting Sensitive Data at Rest and in Transit

Learn how to encrypt Terraform state files at rest with S3 SSE-KMS and in transit with TLS, plus best practices for protecting sensitive data in state files.

✓ Live

Terraform IAM Permissions: Least Privilege Roles for Terraform Execution

Learn how to design least-privilege IAM policies for Terraform execution, scoping permissions by service, resource, and condition for production safety.

✓ Live

Terraform Security Scanning: Checkov, tfsec, and Terrascan Integration

Learn how to scan Terraform configurations for security issues using Checkov, tfsec, and Terrascan integrated into pre-commit hooks and CI pipeline gates.

✓ Live

Terraform Sensitive Values: Marking Variables, Outputs, and State as Sensitive

Learn how to use Terraform sensitive variables and outputs to mask passwords, API keys, and secrets in CLI output, logs, and state file storage for security.

✓ Live

Terraform Cost Optimization: Right-Sizing Resources and Budget Controls

Learn how to optimize cloud costs in Terraform by right-sizing instance types, using spot instances, tagging for cost allocation, and budget enforcement.

✓ Live

Terraform Naming Conventions: Consistent Resource and Module Naming Standards

Learn Terraform naming conventions for resources, modules, and variables that improve readability, searchability, and consistency across your codebase.

✓ Live

Terraform Resource Already Exists: Fixing State Drift and Import Errors

Learn how to resolve Terraform errors when a resource already exists outside state: fix drift, import existing resources, and prevent duplicate creation.

✓ Live

Terraform Provider Authentication Errors: AWS, Azure, and GCP Credential Fixes

Learn how to fix Terraform provider authentication errors for AWS, Azure, and GCP: credential chain issues, expired tokens, and missing permission policies.

✓ Live

Terraform State Lock Error: Force Unlock and Stale Lock Recovery

Learn how to fix Terraform state lock errors: identify stale locks from interrupted runs, safely force unlock, and prevent contention in team workflows.

✓ Live

Terraform Dependency Cycle: Debugging Circular Resource Dependencies

Learn how to identify and fix Terraform dependency cycles: graph visualization, splitting resources, and redesigning circular references for clean configs.

✓ Live

Terraform Plan Shows Unexpected Changes: Debugging State and Configuration Mismatches

Learn why Terraform plans show unexpected changes and how to debug mismatches caused by drift, provider updates, interpolation changes, or external changes.

✓ Live

Terraform Associate Certification: Complete Exam Guide and Study Resources

Learn how to pass the HashiCorp Terraform Associate certification: study guide covering exam objectives, practice questions, and recommended resources.

✓ Live

Terraform Learning Path: Roadmap from Beginner to Production Expert

Learn Terraform from beginner to expert with a structured path covering CLI basics, state management, modules, CI/CD, and production deployment patterns.

✓ Live

Terraform Interview Questions: Top Questions for DevOps and Cloud Engineer Roles

Learn the most common Terraform interview questions covering state management, modules, workspaces, backends, providers, and real-world scenario problems.

✓ Live

Terraform Portfolio Projects: Building Real-World IaC for Your Resume

Learn how to build a Terraform portfolio with real projects: multi-tier architecture, Kubernetes on EKS, serverless apps, and CI/CD pipeline automation.

✓ Live

Terraform Production Deployment Tips: Lessons from Real-World Infrastructure Teams

Learn production Terraform tips from DevOps teams: remote state patterns, module design, CI/CD safety, cost governance, and avoiding enterprise pitfalls.

✓ Live

All 88 topics in Terraform — Complete Guide are published.