This project is a small Terraform setup that builds a simple network environment in Microsoft Azure.
It creates:
- one Resource Group,
- one Virtual Network, and
- one Subnet.
The goal isn't scale at this point. It's to show how IaC works end-to-end: describe what you want, plan it, apply it, and tear it down cleanly.
When you run terraform apply, Terraform talks to Azure through the azurerm provider.
It sends API calls to create:
- a resource group named tf-lab-rg,
- a virtual network called tf-lab-vnet (10.0.0.0/16),
- a subnet called tf-lab-subnet (10.0.1.0/24).
All of this is tracked in terraform.tfstate, so Terraform always knows what exists and what needs to change.
terraform init
terraform plan
terraform apply
terraform destroyYou can run everything directly from Azure Cloud Shell. It already has Terraform and the Azure CLI installed.
- main.tf - core config (resource group, network, subnet)
- variables.tf - defines location and other inputs
- outputs.tf - prints resource names after apply
After applying, Terraform shows:
resource_group_name = "tf-lab-rg"
vnet_name = "tf-lab-vnet"
subnet_name = "tf-lab-subnet"
- First runs can hang while Azure registers providers. Patience is key.
- The plan/apply/destroy loop teaches declaractive automation hands-on.
- Small, working examples are great for learning and can be more effective than complex diagrams.
- Add a Linux VM and network interface.
- Move Terraform state to remote Azure Storage.
- Wrap commands in a small Go CLI helper.
MIT