
Learn the basics of infrastructure as code with Terraform on Azure, cover setup, core commands, data sources, state, modules, drift, and Terraform Cloud for collaborative workflows.
Explore the benefits of infrastructure as code with Azure and Terraform, including automated tooling, code-based documentation, drift correction, identical environments, and faster, cost-efficient deployments.
Explore declarative versus imperative approaches to infrastructure as code, and see how Terraform compares with ARM templates, Azure Bicep, CloudFormation, and Pulumi across Azure, AWS, Google, and on‑prem environments.
Use version control to manage infrastructure as code with Terraform, establishing code as the source of truth, while Azure handles deployment with unit testing, code scans, ci/cd, and cost checks.
Explore differences between Arm templates, Azure Bicep, and Terraform for Azure, focusing on Json vs Hcl, declarative config, planning with what-if, policy precheck, drift, and multi-cloud.
Explore the Terraform ecosystem—from open-source GitHub access and the public registry to comprehensive Terraform.io docs for Azure—highlighting TerraTest, Thrive, and TFX for testing, static code analysis, and security.
Master the Terraform workflow on Azure by learning core concepts such as resources, data sources, providers, variables, and modules, and the init, plan, apply, and destroy lifecycle with state management.
Download Terraform from terraform.io for Windows AMD64, extract the zip, and unblock it. Add the folder to your system PATH and verify the installation with terraform --version.
Install and configure Visual Studio Code for Terraform, adding the HashiCorp Terraform extension for IntelliSense and syntax highlighting, plus a snippets extension to speed up coding.
Explore how to use Terraform with Azure by navigating registry.terraform.io, selecting providers, and initializing the Azure RM provider with features, versions, and practical examples.
Open Visual Studio Code, create a hello world Terraform project folder, and run Terraform init to download the Azure ARM provider from registry.terraform.io and set up a local workspace.
Use Terraform fmt to automatically format Terraform code, align equals signs, and apply standard formatting to an Azure resource group example with location, name, and optional tags.
See how Terraform format cleans up code formatting while Terraform validate checks syntax without touching state or variables, demonstrated with an invalid argument scenario.
Explore how Terraform plan performs a speculative validation of an Azure resource group configuration, highlighting required features blocks, authentication, and the difference between plan and apply with state management.
Install the Azure CLI on Windows (MSI) and ensure it's on your system path, verify by running az, and use it to log into your subscription before running Terraform apply.
Learn how to apply Terraform to create an Azure resource group named example in East US, using plan and apply, with az login and Visual Studio Code integration.
Update tf files after apply, and run terraform apply again to detect changes; changing a resource location requires replacement, destroying east US and recreating west US, with plan indicators.
Learn to use Terraform variables to avoid hardcoding regions by declaring a string region and passing it via command line or pipelines to deploy East US or West US resources.
Learn to streamline terraform workflows by using a terraform.tfvars file to declare region (West US), so terraform apply runs automatically with these values.
Create and configure an Azure storage account with Terraform, including resource group, West US location, name rules, replication options, and tags, while using plan and apply and managing Terraform state.
Automate infrastructure updates with Terraform apply -auto-approve, adding environment and owner tags to resources, and generate cost reports without prompts or destruction.
Learn how Terraform locals clean up code by defining local variables, then reference them as local.name in resources and interpolate strings with ${local.name} for in-place updates without destroying resources.
Learn how to use Terraform outputs to retrieve Azure storage account details. Export keys and host to the tf state and mark them as sensitive.
Organize your Terraform projects by splitting configuration into multiple files, such as provider.tf, variables.tf, and outputs.tf, on Azure, while Terraform still plans and applies with no changes.
Destroy azure resources with Terraform destroy, removing all items tracked in the tf state from your subscription. It shows dependency order, starting with storage accounts and ending with resource groups.
Learn how to create an Azure virtual machine with Terraform, including resource groups, vnet, subnet, network interface, and selecting Linux or Windows images, using init, plan, and apply.
Explore local exec provisioners in Terraform for an Azure Windows VM, including running local commands and writing the VM's private IP to a file, plus state-driven behavior.
Learn how to configure Terraform's remote-exec to run a PowerShell PS1 on a new Azure Windows VM, using a win connection and admin credentials.
Copy a local file to an Azure VM using the file provisioner in Terraform, specifying source and destination, and ensure provisioners run in the defined order.
Explore using a null_resource with local-exec provisioners and depends_on to poll external statuses, such as Azure VM instance view, and manage cross-resource provisioning and replacement in Terraform.
Explore data sources in Terraform to read existing Azure resources, such as resource groups and storage accounts, without creating them, and use the results to plan and apply.
Learn how to use Terraform's count to create multiple resources, name them with interpolation of count.index, and adjust outputs and plans for scalable Azure deployments.
Learn to use for_each in Terraform on Azure to replace count, create multiple resources with unique, lowercase keys from each.key and each.value, and manage outputs with values.
Learn how to use the Terraform lifecycle meta-argument to control resource creation and destruction on Azure, including prevent_destroy, create_before_destroy, ignore_changes, and precondition checks, with apply, plan, and the target flag.
Learn to use dynamic blocks in Terraform to automate Azure network security group rules with for_each and content, reducing copy-paste by sourcing rules from locals.
Explore the built-in functions in Terraform, including numeric, string, and collection types, plus encoding and crypto options, and IP network functions.
Manipulate the Terraform state file using the CLI, including list, move, show, and replace provider. Rename a subnet in state without touching Azure, then apply shows no cloud changes.
Explore how Terraform state drift affects Azure resources and learn to perform apply replace and refresh, including a hands-on virtual machine replacement and later import, with portal changes as scenario.
Refresh the Terraform state with Terraform apply --refresh-only to detect drift after a portal deletion, keeping Azure resources and tf state in sync.
Learn how to use Terraform import to add an Azure resource to state, distinguish it from refresh, and populate the minimal attributes in main.tf for successful planning.
Create and reuse a simple Terraform module by structuring main.tf, declaring variables with defaults, and exposing outputs, then instantiate it in a project and run init, plan, apply.
Explore using a registry-hosted Azure compute module to deploy a Windows VM, supply required inputs, leverage data sources for an existing subnet, and run init, plan, and apply.
Publish a public Terraform module on GitHub and the Terraform registry by preparing a minimal module with a README, license, gitignore, and GitHub-based sources.
Publish a terraform module to registry.terraform.io by configuring a public GitHub repo, adding a semantic version tag, and detailing inputs, outputs, and Azure dependencies.
** Added a quiz of 24 multiple choice questions.
Are you familiar with Infrastructure as Code and tools such as ARM Templates, Bicep, and Terraform? If you’re interested in mastering the art of managing Infrastructure with the help of a powerful language called HCL, and running it on multiple cloud providers, then this course is for you!
Join us on a journey through the architecture overview of a declarative approach to IaC vs imperative, with a focus on Microsoft Azure as a cloud provider. Throughout the course, you’ll learn the lifecycle of Terraform commands, including when and how to use them.
In addition, the course will emphasize the importance of state files and demonstrate how to manage them on your own, within a team, or by utilizing the powerful Terraform Cloud approach. We’ll also cover the use of the Registry while using and building Terraform Modules for real-life scenarios, making it easy for you to implement Terraform in your everyday infrastructure projects.
By the end of this course, we are confident that you will have a strong understanding and practical experience of how to be successful in using Terraform to build your next infrastructure architecture and deployment.
Course Outline
Introduction
Architecture
Setup and Installation
Terraform Commands
Provisioners
DataSource
HCL Language
TFState
Drift
Modules
Backends
Cloud
Samples
Quiz