Skip to main content

Command Palette

Search for a command to run...

Terraform Home Lab for Beginners.

Published
3 min read
M

I’m Md. Rasel, a DevOps Lead at Synesis IT PLC with over a decade of experience in DevOps, Cloud Infrastructure, and Virtualization. My work blends automation, scalability, and reliability to help organizations build resilient, high-performing systems.

I specialize in Kubernetes, Docker, Terraform, Jenkins, AWS, OCI, and Proxmox VE, along with CI/CD pipeline design, cloud-native application deployment, and infrastructure automation. My experience spans managing multi-tier applications, orchestrating containerized workloads, implementing secure DevSecOps practices, and optimizing cloud resources for cost and performance.

Beyond hands-on engineering, I’m passionate about mentoring and training, having conducted technical workshops on topics like Kubernetes, network automation, monitoring, and cloud strategies at universities and industry events.

When I’m not solving infrastructure challenges, I share insights on DevOps best practices, automation strategies, cloud-native technologies, and real-world troubleshooting—making complex tech approachable and actionable.

Specialties:

CI/CD Pipelines (Jenkins, GitLab CI)

Kubernetes & Container Orchestration

Infrastructure as Code (Terraform, Ansible)

Cloud Platforms (AWS, Oracle Cloud, Azure)

Monitoring & Observability (Prometheus, Grafana, ELK, Zabbix)

DevSecOps & Security Automation

💡 Let’s connect—I’m always open to discussions about scalable architectures, DevOps automation, and cloud-native innovations.

This writing is for those who wants to practice terraform but they are unable to afford any cloud environment. Many of us also wants to practice the terraform without any hassle and free of cost. so this article is based on that. If yo have a windows machine and enough core and memory to run virtual machine you can follow the instructions.

We can run our test terraform code into our home lab using windows pc with virtualbox. We can create update and manage our virtual box vm with terraform by using some provider. Let’s talk about the process.

Step 1: Virtualbox Installation on windows

Ensure that VirtualBox is installed on your Windows system. You can install virtualbox by downloading from bellow link.

Oracle VirtualBox

Step 2: Install Terraform:

Download and install Terraform for Windows from the official Terraform

website

Step 3: setting up terraform environment

To run the terraform code from any directory of your machine you need to set the system path of terraform.

Steps to add Terraform to the system PATH:

  1. Open System Properties:

    • Right-click on This PC or My Computer and click Properties.

    • Click Advanced system settings on the left side.

    • In the System Properties window, click on the Environment Variables button.

  2. Add Path to Environment Variables:

    • In the Environment Variables window, under System variables, scroll down and find the Path variable. Select it and click Edit.

    • Click New, and then enter the path to your Terraform executable: E:\My Personal\terraform_1.9.7_windows_386.

    • Click OK to close all the windows.

  3. Verify:

  • Open a new Command Prompt or PowerShell and type:

      terraform --version
    
💡
Now before running our first terraform code we need a provider for VirtualBox terraform. Here i am using terra-farm/provider for my practice.

Download the terra-farm provider and extract it on the windows machine. now we need to configure the path of terra-farm on window.

Now we are ready for our first Terraform code running on windows to create virtual machine on VirtualBox.

Create a directory, under that create a file called main.tf

terraform {
  required_providers {
    virtualbox = {
      source = "terra-farm/virtualbox"
      version = "0.2.2-alpha.1"
    }
  }
}

# There are currently no configuration options for the provider itself.

resource "virtualbox_vm" "node" {
  count     = 2
  name      = format("node-%02d", count.index + 1)
  image     = "https://app.vagrantup.com/ubuntu/boxes/bionic64/versions/20180903.0.0/providers/virtualbox.box"
  cpus      = 2
  memory    = "512 mib"
  #user_data = file("${path.module}/user_data")

  network_adapter {
    type           = "bridged"
    host_interface = "Intel(R) Wireless-AC 9560 160MHz"
  }
}

output "IPAddr" {
  value = element(virtualbox_vm.node.*.network_adapter.0.ipv4_address, 1)
}

output "IPAddr_2" {
  value = element(virtualbox_vm.node.*.network_adapter.0.ipv4_address, 2)
}

Steps to Proceed:

  1. Adjust the host interface: Make sure that the correct bridge adapter is used, such as "Intel(R) Wireless-AC 9560 160MHz".

Run Terraform:

  • Initialize Terraform:
terraform init
  • Check the plan:
terraform plan
  • Apply the configuration:
terraform apply

Hope this will help you to run the terraform on windows for VirtualBox. Setup your home lab for Terraform and enjoy the learning.