
This chapter has the slides and diagrams download
Download diagrams, slides, and per-section Terraform code, open the folders in Visual Studio Code, and study Azure resource blocks with linked Terraform documentation.
This chapters covers a quick note on the course expectations
This chapters covers what is Terraform
This chapters covers why terraform is important
This chapters covers the Terraform workflow
This chapters covers the Terraform editions
This chapters covers Installing Terraform
Explore Azure as a leading cloud platform with services from virtual machines to Azure Kubernetes Service and AI offerings, and learn how to start with an Azure account.
This chapters covers using the Azure Free account
This chapters covers creating an Azure Free account
This chapters covers a tour around the Azure Portal
This chapter has the code download for the section
Install Visual Studio Code on Windows, Mac OS, or Linux to build Terraform configuration files written in the HashiCorp Configuration Language, and add Terraform extensions for enhanced support.
Create your first terraform configuration file for Azure by defining a terraform block with the Azure provider and version, guided by the Terraform docs and a Visual Studio Code setup.
Terraform authenticates to Azure using the Microsoft enter ID or a service principal with a client secret, and then performs authorization to deploy resources via the Azure provider.
Create a new user in Azure ID, sign in via the portal and Azure CLI, and prepare a Terraform deployment context using that user's credentials.
This chapters covers creating a resource group
Define Terraform configuration files with the HashiCorp configuration language to deploy Azure resources via resource blocks, setting type, name, and arguments such as name and location.
This chapters covers the plan and apply phase
Review the Terraform plan to see what will be deployed, including the resource group. Apply the plan with terraform apply to deploy the resource in Azure.
Learn about terraform generated files in Azure deployments, including plan file and main.tf plan, state file in JSON, log, and hidden .terraform folder for the Azure provider.
Learn to authenticate Terraform on Azure with an application object, create an app registration, capture client ID, tenant ID, and client secret, and assign a contributor role.
This chapters covers creating an Azure Storage account
Deploy an Azure Storage account with Terraform by defining a resource block, choosing account kind and tier, and running plan and apply.
This chapters covers uploading a Blob
This chapters covers important points in Terraform
Reference Azure resources in Terraform by using the resource type and managed resource name to avoid hard coding; verify with a plan and save changes.
Learn to use the Terraform destroy command to remove your Azure resources—storage account, container, blob, and resource group—while maintaining a single source of truth and avoiding unnecessary costs.
This chapters covers dependency across resources
This chapters covers reviewing the creation of an Azure virtual machine
This chapters covers a lab on creating an Azure virtual network
This chapters covers using local variables
Split your terraform configuration into multiple files to improve readability and maintainability. Place locals in locals.tf, provider config in terraform.tf, and use a main.tf base file.
This chapters covers a note on types and variables
This chapters covers using a map of values
This chapters covers another way of creating subnets
This chapters covers output values
This chapters covers creating a Public IP address
This chapters covers creating a network security group
This chapters covers creating a network security group via terraform
This chapters covers creating an Azure virtual machine
Explore how Terraform state files map Azure resources to Terraform managed objects, including network interfaces, network security groups, public IP address, virtual networks, and Windows virtual machines.
Explore using input variables in Terraform on Azure by defining a string variable for the virtual machine name, passing it to the resource block during plan creation.
Pass variables to terraform via a separate variable definition file and a values file, defining the vm name and admin username as input variables loaded from a tfvars file.
Define input variables for vm size and admin password, mark the password as sensitive, and prompt for it; then validate, plan, and apply to deploy a standard_b2s azure vm web-vm-01.
Learn to create and attach a data disk to an Azure VM with Terraform, using a manage disk resource and plan and apply steps.
This chapters covers keeping a check on the costs
This chapter has the code download for the section
This chapters covers the count meta argument
Explore how the Terraform state file tracks multiple Azure storage accounts with a single resource block using count and count.index.
This chapters covers the for each meta argument
This chapters covers the for each meta argument for blobs
This chapters covers creating multiple subnets
Create multiple public IP addresses in Terraform on Azure by pairing web interfaces with corresponding public IPs using count and index mapping, and then switch to foreach for iteration.
Define subnet information as a map of objects variable to supply CIDR blocks for web and app subnets, replacing hard-coded values and retrieving CIDR blocks via each key in main.tf.
This chapters covers a lab on adding the network security group
This chapters covers creating multiple machines
This chapters covers availability sets
This chapters covers availability zones
This chapters covers a lab on the key vault service
Deploy an Azure Key Vault with Terraform by creating a simple security.tf, configuring tenant ID and resource group, and using RBAC over access policies, then plan and destroy.
This chapters covers data sources
Deploy a Windows-based web server on Azure using a custom script extension and Terraform to install Internet Information Services, create a default page, and open port 80 for HTTP.
Deploy a Windows web server on Azure with Terraform by using a custom script extension to download and run an iis setup and default html from storage.
Learn how to use dynamic blocks and for_each in Terraform on Azure to create multiple security rules inside a single network security group resource, using local values and plan/apply workflows.
Deploy a Linux Ubuntu server VM using Terraform in Azure, configure a public IP and port 80, and install nginx via cloud init to host a web server.
Read a local cloud-init file and pass its text content to a Linux VM resource in Terraform on Azure, using a data block with the local_file data source.
Restructure terraform input variables to grant each linux VM its own network interface and public IP, using a machines block and for_each to support multiple subnets and scalable deployment.
Learn how Terraform uses the state file to index managed resources like network interfaces, driven by machine names and count or for_each, as shown in main.tf.
Deploy a Linux Azure VM with Terraform in app subnet zero one, assign a public IP, and configure with Ubuntu Server 22.04 and base64 cloud init data.
Use terraform provisioners to copy default.html to the remote linux server with the file provisioner, then move it to /var/www/html via remote-exec, using ssh on port 22 and depends_on.
Deploy the Azure Bastion resource with Terraform, creating a dedicated bastion subnet and a public IP, to securely connect to Windows RDP and Linux SSH via the Azure portal.
This chapter has the code download for the section
Explore using Terraform to provision Azure Web App Service and its underlying infrastructure, with an introduction to the Azure Web App Service, deployment options, and managed vs VM hosting.
This chapters covers a lab on Azure Web App
Publish a simple dotnet core web app to an Azure web app, using Visual Studio Code with Azure Tools, deploy the code, and prepare to provision the infrastructure with Terraform.
This chapters covers a lab on Azure Web App via Terraform
Resolve Azure web app site config issues in Terraform by switching to a basic app service plan and updating SKU and always on to align the plan with configuration.
Explore how to leverage the Terraform lifecycle meta-argument with Azure web apps, handling updates, ignored changes, and plan behavior to manage virtual application blocks and app service configurations.
Tag Azure resources with Terraform by defining a map of object tags in variables.tf, applying department and tier tags to resources, and validating tagging via plan and apply.
Learn to debug terraform by enabling log levels from trace to errors and inspecting the terraform.log generated when planning against Azure.
This chapters covers an understanding on deployment slots
This chapters covers deployment slots via Terraform
Demonstrates deploying and testing versions in a staging slot, then swapping it with production using a Terraform configuration, including plan and apply steps and slot removal.
Enable and configure azure web app logs with app service logs, including application and web server logging, detailed error messages, stored in azure storage via sas, managed by terraform.
Provision Azure SQL Database resources with Terraform configuration files, learning the shift from virtual machine hosting to the managed service with integrated backups, high availability, and security.
This chapters covers a lab on Azure SQL database
This chapters covers a lab on Azure SQL database via Terraform
This chapters covers Azure SQL database firewall settings
Learn how to deploy another Azure SQL database on the same server using Terraform, organizing environments and servers as maps of objects, and preparing input variables before creation.
Configure Terraform to deploy an Azure SQL database with optional Adventureworks Lt sample data, using maps of servers and databases, flattening nested objects into a flat detail list.
Flatten a nested database details structure into a map of objects with database name keys, then deploy two SQL databases on Azure using Terraform with for each and local variables.
Seeding an Azure SQL database with initial data using Terraform and a local-exec provisioner, creating a course table and inserting three rows via sqlcmd.
Learn how to deploy an Azure web app that pulls code from a GitHub repository, publish it with Terraform, and connect the app to an Azure SQL database.
This chapters covers connecting a web app to SQL database
Explore a Terraform on Azure mini project that connects a public Azure web app to a private MySQL database hosted on a virtual machine via virtual network integration.
Build an Azure VM with MySQL installed via Terraform, bootstrapped by cloud-init on Ubuntu; configure the virtual network and security, then access MySQL as root.
Bootstraps a MySQL database on an Azure VM by creating a database, table, and data from a 01.sql script using Terraform provisioners and a db config.
Publish the web application to a GitHub repository, using git init, add, commit, branch, and remote origin, then push the MySQL-enabled dotnet app to the main branch.
Deploy a web app from GitHub to an azure web app using Terraform, configuring a service plan, app service, and a private database connection via virtual network integration.
Implement virtual network integration for an Azure web app with Terraform, create an app subnet with delegation, plan and apply, then verify private connectivity to the database.
Learn how Terraform uses providers to interact with Azure, configuring a provider block with client ID, client secret, tenant ID, and subscription ID.
Define multiple providers in a single Terraform configuration to manage Azure storage accounts and AWS S3 buckets. Initialize the directory, plan the changes, apply resources, and destroy when needed.
Master terraform init, plan, and apply to synchronize configuration with azure, then use destroy, validate, and format commands to manage infrastructure effectively.
Explore how Terraform uses the state file to reconcile configuration with target state, and use terraform state list and terraform state show to inspect a resource group and storage account.
Learn how to import an existing Azure storage account into your Terraform state by adding a resource block, preparing a plan, and applying with an import block.
Explore the built-in functions in Terraform, including max and string operations like ends with, join, replace, and substring, and practice with the Terraform console.
Explore Terraform data types, including string, number, bool, list, set, and map, using locals.tf and the Terraform console to access values by index and key.
Define and manage input variables in Terraform on Azure using locals and tfvars. Apply validation and work with complex types like lists and maps of objects.
Explore reading a local file in Terraform for Azure by using the file function or a data block to read locals.tf contents, then plan and apply to view outputs.
Learn how the Terraform taint command marks a degraded object as tainted in the state and prompts replacement in the next plan; later versions add a replace option.
Use data sources and data blocks to query resources in the target system, including those not managed by Terraform or matched by Terraform, and use count, for_each, and dynamic blocks.
This chapter has the code download for the section
Explore how the Azure load balancer distributes traffic across backend virtual machines using a frontend IP, backend pool, health probe, and load balancing rules, with Terraform for provisioning.
This chapters covers the Azure Load Balancer setup
This chapters covers the Azure Load Balancer implementation
Explore using Terraform modules to reuse infrastructure code on Azure, organizing resources into parent and child modules, and passing data with input and output variables for multi-environment deployments.
Learn to build reusable Terraform modules for Azure resources, starting with a resource group module, passing data via input variables, and calling modules from a root module.
Define a modular virtual network in Terraform for Azure: create a resource group and VNet module with subnet counts using CIDR subnet, then manage dependencies and run init, plan, apply.
Learn to build backend resources with Terraform modules by provisioning public IP addresses and network interfaces across subnets, using count and index to plan, apply, and verify resources.
Build and manage a network security group in Terraform on Azure by defining security rules, converting a list to a set, and attaching the NSG to multiple subnets.
Build and deploy two linux virtual machines on Azure using Terraform modules, passing network interface IDs from the VNet module through outputs, and using cloud init to install nginx.
Configure a copy files resource with count to deploy content to each Azure VM, create default.html, and verify web VMs 01 and 02 before deploying the load balancer module.
Build an Azure load balancer with Terraform by creating a reusable module that defines the public IP, front-end IP config, backend pool, health probe, and load balancing rule.
This chapters covers the manual process of virtual machine scale set deployment
This chapters covers the virtual machine scale set deployment via terraform
This chapters covers what is Azure Traffic Manager
This chapters covers implementing Azure Traffic Manager
This chapters covers implementing Azure Traffic Manager via Terraform
This chapters covers Azure Traffic Manager implementation
This chapters covers a note on deleting Azure Traffic Manager
This chapters covers the network setup for virtual network peering via Terraform
This chapters covers the NSG setup for virtual network peering via Terraform
This chapters covers the peering connection setup for virtual network peering via Terraform
This chapters covers the backend setup for the Application Gateway
Restructure terraform code to modularize resources for Azure application gateway, use script extensions to bootstrap nginx on Linux VMs, and store scripts in a storage account with containers and blobs.
Restructure terraform for Azure application gateway deployment by flattening nested network data, using locals.tf and for_each to build virtual networks, subnets, and interfaces, while removing public IPs.
Build two virtual machines behind the azure application gateway with terraform, a video-based and images-based server. Configure network interfaces, data blocks, and for_each deployment; install nginx and verify with curl.
Learn to restructure Terraform code by building a hierarchical map of objects for virtual networks and subnets, using for expressions and flatten to pass subnet details to modules.
Build an Azure application gateway with Terraform by creating a gateway subnet and public IP, configuring front end and image backend pools, and url path based routing to VMs.
This chapters covers the VM setup for Azure Firewall
This chapters covers the Firewall deployment for Azure Firewall
This chapters covers the subnet route for Azure Firewall
This chapters covers the NAT rule for Azure Firewall
This chapters covers the Application rules for Azure Firewall
Learn to use a terraform registry module to provision an Azure virtual network with subnets, including source, version, address space, and location, then run init, plan, apply, and destroy.
Explore how Terraform modules organize resources, load from the registry with a source and version, and manage data with input variables and outputs, using init upgrade, count, for_each, and depends_on.
Explore monitoring on Azure using Terraform to build an Azure monitoring service setup with alerts and a Log Analytics workspace, including configuring alert rules and action groups.
Create and configure a log analytics workspace to collect logs from virtual machines and Azure services, define data collection rules, and query events with kql.
Configure an action group and metric alerts in Azure using Terraform, deploying two VM monitoring rules with foreach, scope by resource IDs, and email notifications verified in Azure Monitor.
Build a log analytics workspace with Terraform and create a data collection rule for windows event logs and system events. Then associate the rule with your virtual machines.
Learn to use Microsoft Azure ID and role-based access control to create users and assign built-in and custom roles to resources at subscription, resource group, or resource level with Terraform.
Define users in Azure AD and grant permissions with role assignments, scoped to subscription, resource group, or resource, using roles like virtual machine contributor and reader.
Learn to lock Azure resources with Terraform by applying management locks—cannot delete and read-only—on resources like web vm and app network, using id, type, and resource group.
Apply a minimal Azure landing zone with hub-and-spoke networking, Azure Bastion and Azure Firewall, dedicated application network subnets, and separate resource groups for logging, storage, security, and SQL.
Learn to create multiple Azure resource groups with Terraform using foreach and a map variable, provisioning networking, logging, storage, security, and database groups via plan and apply.
Build a virtual network in Azure with Terraform, creating a VNet, subnets (app, web, gateway, Azure Bastion, Azure Firewall) and conditional network security group rules driven by environment data.
Learn to configure terraform on azure to provision multiple log analytics workspaces for an application landing zone, using variable-driven modules, random name suffixes, and plan and apply steps.
Deploy Azure storage accounts with Terraform, enabling hierarchical namespace for data lake Gen2, and provision two accounts for security and data engineering using a storage module.
Learn to deploy Azure SQL databases with Terraform: create a db app environment with two SQL servers (engineering and central) and two databases, using modular code and plan-apply workflow.
Deploy an Azure key vault and apply governance with Azure policies at subscription level or resource group level, using a module with for_each to create vaults and pull tenant ID.
Terraform assigns an Azure policy to a resource group, enforcing allowed resource types. The lecture demonstrates policy definitions and assignments using a map of objects and data blocks.
Learn how to deploy identical azure resources for dev and prod using terraform, test code in dev, and promote infrastructure across environments.
Explore the initial Terraform code base using modules to deploy a resource group, virtual network, and VMs, with depends_on for subnets, and use plan and apply to manage Azure environments.
Learn how to deploy to multiple environments with Terraform on Azure using dev and prod tfvars. Explore plan, apply, modules, and state considerations for managing resource groups and networks.
Learn to use terraform workspaces to maintain separate state files for dev and prod, switch between workspaces, and dynamically name resources based on the current workspace.
Utilize Terraform workspaces to dynamically build a dev environment, selecting address space and subnets from environment blocks, while separate prod values and state keep environments isolated.
Build a prod environment with Terraform workspaces alongside dev, creating prod workspace to provision a prod virtual network (10.1.0.0/16) in a prod resource group and then destroy resources and workspaces.
Learn to manage terraform environments with git version control, from installation and repo initialization to committing changes and using online repositories like GitHub.
Install git on your local machine to manage different versions of your Terraform code, selecting the Windows 64-bit standalone installer and accepting default settings.
Install git locally and build a git-based repo for Terraform code to deploy a dev Azure environment with a virtual network, VMs, using count; initialize, stage, and commit.
Publish your local git repository to a remote GitHub repository by creating a dev branch and pushing committed code, while managing credentials in providers.tf.
Modify the main.tf to attach data disks to virtual machines using count.index in Terraform on Azure, track changes with git, and push updates to the dev branch on GitHub.
Master git branch strategies for multiple developers and environments, including creating a production branch from dev on GitHub and merging feature branches with admin review.
Download the Terraform code from the dev branch, initialize the directory, plan and apply changes to Azure, and use GitHub for version control while addressing state file concerns.
Create a production branch from dev, manage feature branches with git, and merge changes through pull requests to keep production in sync with development for Terraform on Azure.
Promote dev changes to the production branch via a pull request, then apply Terraform for the production environment on Azure. Manage multiple state files to separate dev and prod configurations.
Learn to store Terraform state remotely on Azure storage accounts, using backend configuration with separate containers for prod and dev to manage multiple environments.
Organize Terraform on Azure projects using environment-specific folders for dev and production within a single repository, with modules for networking and compute.
Explore HCP Terraform, a managed cloud service that runs Terraform configurations, handles variables, state data, and plan and apply, while connecting to version control and teams.
Learn how to create and manage Terraform workspaces in Terraform Cloud, connect to GitHub, run plan and apply from the UI, and manage per-workspace state for deploying Azure resources.
Create a production based workspace in Terraform on Azure from the production branch with edited vars. Plan, apply, and verify production resources using a separate state file for this workspace.
Manage Terraform on Azure across dev and prod environments with automated plan and apply triggered by Git commits, using workspaces to tag public IPs and update identities.
Learn to provision Azure resources with Terraform to host container-based applications. Install Docker on a Linux VM, run a simple container, and create a Docker image from a basic app.
Deploy a new resource group and an Azure Linux VM (Ubuntu 24.04) in North Europe, then install the Docker engine and run a web server container on port 80.
Run an nginx container on a Linux VM using docker run, pulling nginx from Docker Hub, and map port 80 to the Azure VM to verify via http.
Create a Docker image from a PHP app, learn to build and run containers, and prepare for deploying on Azure Container Registry and Azure Container Instances, with Kubernetes clustering later.
Log in to the Azure Container Registry with admin credentials, tag the local docker image, push it, and deploy via Azure Container Instance exposing port 80.
Deploy a single Azure container instance with Terraform, pulling a PHP app container image from Azure Container Registry, and configure secure credentials.
Deploy an Azure Kubernetes cluster using Terraform, configuring secure credentials via environment variables and Azure Key Vault, and manage state with Azure Storage.
Learn how to implement continuous integration and deployment for Terraform on Azure using Azure DevOps, Azure Repos, and pipelines to automatically build, test, and deploy code.
Demonstrates setting up continuous integration with azure devops for a dotnet web app and terraform infrastructure, including creating a devops project, dotnet app, and azure web app resources.
Publish your dotnet project to a git-based Azure DevOps repository by initializing a local git repo, committing files, creating a dev branch, and pushing to Azure Repos.
Set up a build pipeline in Azure DevOps that triggers on Azure Repos Git changes, builds a dotnet app with a YAML pipeline.
Learn to automate deployment in Azure using Azure DevOps release pipelines, integrating Terraform to provision infrastructure, manage artifacts, and deploy an Azure web app.
Right here! Avail special discount coupon links for all of my Al Azure and AWS Courses
This course is meant to help students create a Terraform configuration to deploy an Azure resource group.
A lot of students have requested to have a course on how to use Terraform to work with Azure-based services. So here it is.
This course has 100+ Terraform configuration files and 10 Assignments
There is also a mini-project for an end-to-end implementation of an application hosting environment
In this course , we will learn a lot including the following
Some basic concepts when it comes to working with Terraform. We need to learn some important concepts when it comes to aspects such as Planning and applying Terraform configuration files.
We will focus on working with Azure Storage Accounts. We will see how to use various Terraform features to create dynamic configuration files when working with Azure services.
Along with looking at Azure Storage Accounts, we will work with Azure Virtual Machines. We will look at
Creating the various components linked to an Azure VM
How to manage data disks
How to use custom script extensions
Using the Azure Key vault to store the Administrator account password
Using the Azure Bastion Host
How to create multiple Azure Virtual Machines
Making machines part of an Availability Set or an Availability Zone
Next we will focus on Azure Web Apps and Azure SQL databases. We will see
How to create Azure Web Apps
Deploy code from GitHub onto the Azure Web App
Deploy an Azure SQL database
Azure SQL Database auditing
How to deploy Azure SQL Server Virtual Machine
Then we will move onto Azure Networking where we will cover
Working with the Azure Load Balancer
Using the Azure Virtual Machine Scale Set
Azure Public DNS Zones
Working with the Azure Application Gateway
How to work with Virtual Network Peering