Uploaded March 2026 | Updated September 2026, 2 weeks ago
๐ Automate MikroTik Router Configuration with Terraform | Infrastructure as Code Tutorial
Tired of logging into WinBox or SSH every time you need to change a firewall rule, add a DHCP lease, or reconfigure an interface? In this complete step-by-step tutorial, you'll learn how to use Terraform to fully automate your MikroTik RouterOS configuration โ the same way DevOps engineers manage cloud infrastructure, but applied directly to your network hardware.
Whether you're managing a homelab, a small business network, or a multi-site enterprise deployment, this video will show you how to bring the power of Infrastructure as Code (IaC) to your MikroTik routers โ making your configs repeatable, version-controlled, and disaster-recovery ready.
๐ก Why Terraform + MikroTik?
MikroTik routers are incredibly powerful โ but managing them at scale manually is slow, error-prone, and impossible to audit. With Terraform, you define your entire router configuration in simple .tf files, commit them to Git, and apply changes in seconds. Forget clicking through menus or memorizing RouterOS commands โ your config becomes code.
โ Reproducible โ spin up identical configs across multiple routers instantly
โ Version-controlled โ track every change in Git like a software project
โ Self-documenting โ your .tf files are your documentation
โ Disaster-recovery ready โ restore your full config in one command
โ Team-friendly โ collaborate on network changes with pull requests and code reviews
๐ Code in the video:
- providers.tf:
terraform {
required_providers {
routeros = {
source = "terraform-routeros/routeros"
version = "โฉ= 1.0.0"
}
}
}
provider "routeros" {
hosturl = var.mikrotik_host
username = var.mikrotik_username
password = var.mikrotik_password
insecure = true # Usually set to true unless you've installed a custom SSL cert on the router
}
- variables.tf:
variable "mikrotik_host" {
type = string
description = "The IP address or hostname of the MikroTik router (e.g., 192.168.88.1)"
}
variable "mikrotik_username" {
type = string
description = "The admin username for the MikroTik router"
}
variable "mikrotik_password" {
type = string
description = "The password for the MikroTik router"
sensitive = true
}
variable "new_identity" {
type = string
description = "The new name for your router"
default = "MikroTik-HQ"
}
- main.tf
resource "routeros_system_identity" "my_router" {
name = var.new_identity
}
- credentials.auto.tfvars.tf
mikrotik_host = "192.168.1.x"
mikrotik_username = "admin"
mikrotik_password = "xxxxxx"
new_identity = "MikroTik-HQ"
๐ If you found this video useful, like, subscribe, and share to support more networking tutorials about BGP, MikroTik, routing, and network labs.
๐ธ Buy me a coffee :
buymeacoffee.com/liv4it
๐ธ Support channel & make donation :
paypal.me/aminenina/10
๐ธ Subscribe for more videos :
Youtube: youtube.com/user/aminosninatos
๐ธ Follow me On Social Media
Facebook : facebook.com/aminosninatos
***********************************************************************
๐ธ ๐How to Set Up SSH Key Authentication on MikroTik Router
youtu.be/Ks0YcPUclWc
๐ธ ๐Mikrotik BGP Peering with DN42 Network
youtu.be/hHDcGfjJH0I
๐ธ ๐ MikroTik RouterOS Scripting
youtu.be/EsoWYQH6Gk0
๐ธ ๐I Asked AI to Fix My MikroTik Firewall โ Hereโs What Happened
youtu.be/RbI-X0ZXXbg
๐ธ ๐ MikroTik - Protect Your Network from Malicious IPs Using Q-Feeds
youtu.be/UekviUhSu4w
๐ธ How to Configure DNS over HTTPS (DoH) on MikroTik RouterOS v7 | Step-by-Step Guide
youtu.be/CuKNz3_wWIY
๐ธ How to Configure MikroTik Router as a DNS Server | Step-by-Step Guide (RouterOS v6 & v7)
youtu.be/XdcHRmcmm1o
๐ธ MikroTik FastTrack Explained | Boost Your Router Speed & Reduce CPU Usage
youtu.be/-uGWSsv5R9Y
๐ธ MikroTik Firewall Filter Rules Explained | Secure Your Router Against Attacks
youtu.be/CSPhjxYRU0I
๐ธ How To Secure Your MikroTik Router โ Complete RouterOS Hardening Guide
youtu.be/Hb0hiZLOzfg
๐ธ MikroTik RouterOS Connect LAN Network To The Internet
youtu.be/CSU-GqJF27k
๐ธ MikroTik RouterOS Basic Configuration | PPPoE Internet Setup Step-by-Step
youtu.be/-XA2nMEz51M
๐ธ How to Install MikroTik RouterOS Long-Term (LTS) on VMware ESXi | Step-by-Step Guide
youtu.be/bZaempHD84I
๐ธ MikroTik RouterOS LTS Explained & Install on Proxmox VE
youtu.be/NRyGPpnQGp8
๐ธ How To Install Packages On Immutable OS Fedora Silverblue
youtu.be/EfEQnRb0o2s
๐ธ Proxmox Containers with Fedora CoreOS Install
youtu.be/iEKlltIsbkE
๐ธ How To run Docker containers (OCI Images) natively in Proxmox 9.1
youtu.be/atOEMusLVtQ
๐ธ Proxmox Install ProxMenux Monitor
youtu.be/VpRGceK8ToQ
***********************************************************************
#Terraform #MikroTik #RouterOS
๐ Automate MikroTik Router Configuration with Terraform | Infrastructure as Code Tutorial
Tired of logging into WinBox or SSH every time you need to change a firewall rule, add a DHCP lease, or reconfigure an interface? In this complete step-by-step tutorial, you'll learn how to use Terraform to fully automate your MikroTik RouterOS configuration โ the same way DevOps engineers manage cloud infrastructure, but applied directly to your network hardware.
Whether you're managing a homelab, a small business network, or a multi-site enterprise deployment, this video will show you how to bring the power of Infrastructure as Code (IaC) to your MikroTik routers โ making your configs repeatable, version-controlled, and disaster-recovery ready.
๐ก Why Terraform + MikroTik?
MikroTik routers are incredibly powerful โ but managing them at scale manually is slow, error-prone, and impossible to audit. With Terraform, you define your entire router configuration in simple .tf files, commit them to Git, and apply changes in seconds. Forget clicking through menus or memorizing RouterOS commands โ your config becomes code.
โ Reproducible โ spin up identical configs across multiple routers instantly
โ Version-controlled โ track every change in Git like a software project
โ Self-documenting โ your .tf files are your documentation
โ Disaster-recovery ready โ restore your full config in one command
โ Team-friendly โ collaborate on network changes with pull requests and code reviews
๐ Code in the video:
- providers.tf:
terraform {
required_providers {
routeros = {
source = "terraform-routeros/routeros"
version = "โฉ= 1.0.0"
}
}
}
provider "routeros" {
hosturl = var.mikrotik_host
username = var.mikrotik_username
password = var.mikrotik_password
insecure = true # Usually set to true unless you've installed a custom SSL cert on the router
}
- variables.tf:
variable "mikrotik_host" {
type = string
description = "The IP address or hostname of the MikroTik router (e.g., 192.168.88.1)"
}
variable "mikrotik_username" {
type = string
description = "The admin username for the MikroTik router"
}
variable "mikrotik_password" {
type = string
description = "The password for the MikroTik router"
sensitive = true
}
variable "new_identity" {
type = string
description = "The new name for your router"
default = "MikroTik-HQ"
}
- main.tf
resource "routeros_system_identity" "my_router" {
name = var.new_identity
}
- credentials.auto.tfvars.tf
mikrotik_host = "192.168.1.x"
mikrotik_username = "admin"
mikrotik_password = "xxxxxx"
new_identity = "MikroTik-HQ"
๐ If you found this video useful, like, subscribe, and share to support more networking tutorials about BGP, MikroTik, routing, and network labs.
๐ธ Buy me a coffee :
buymeacoffee.com/liv4it
๐ธ Support channel & make donation :
paypal.me/aminenina/10
๐ธ Subscribe for more videos :
Youtube: youtube.com/user/aminosninatos
๐ธ Follow me On Social Media
Facebook : facebook.com/aminosninatos
***********************************************************************
๐ธ ๐How to Set Up SSH Key Authentication on MikroTik Router
youtu.be/Ks0YcPUclWc
๐ธ ๐Mikrotik BGP Peering with DN42 Network
youtu.be/hHDcGfjJH0I
๐ธ ๐ MikroTik RouterOS Scripting
youtu.be/EsoWYQH6Gk0
๐ธ ๐I Asked AI to Fix My MikroTik Firewall โ Hereโs What Happened
youtu.be/RbI-X0ZXXbg
๐ธ ๐ MikroTik - Protect Your Network from Malicious IPs Using Q-Feeds
youtu.be/UekviUhSu4w
๐ธ How to Configure DNS over HTTPS (DoH) on MikroTik RouterOS v7 | Step-by-Step Guide
youtu.be/CuKNz3_wWIY
๐ธ How to Configure MikroTik Router as a DNS Server | Step-by-Step Guide (RouterOS v6 & v7)
youtu.be/XdcHRmcmm1o
๐ธ MikroTik FastTrack Explained | Boost Your Router Speed & Reduce CPU Usage
youtu.be/-uGWSsv5R9Y
๐ธ MikroTik Firewall Filter Rules Explained | Secure Your Router Against Attacks
youtu.be/CSPhjxYRU0I
๐ธ How To Secure Your MikroTik Router โ Complete RouterOS Hardening Guide
youtu.be/Hb0hiZLOzfg
๐ธ MikroTik RouterOS Connect LAN Network To The Internet
youtu.be/CSU-GqJF27k
๐ธ MikroTik RouterOS Basic Configuration | PPPoE Internet Setup Step-by-Step
youtu.be/-XA2nMEz51M
๐ธ How to Install MikroTik RouterOS Long-Term (LTS) on VMware ESXi | Step-by-Step Guide
youtu.be/bZaempHD84I
๐ธ MikroTik RouterOS LTS Explained & Install on Proxmox VE
youtu.be/NRyGPpnQGp8
๐ธ How To Install Packages On Immutable OS Fedora Silverblue
youtu.be/EfEQnRb0o2s
๐ธ Proxmox Containers with Fedora CoreOS Install
youtu.be/iEKlltIsbkE
๐ธ How To run Docker containers (OCI Images) natively in Proxmox 9.1
youtu.be/atOEMusLVtQ
๐ธ Proxmox Install ProxMenux Monitor
youtu.be/VpRGceK8ToQ
***********************************************************************
#Terraform #MikroTik #RouterOS


![How To Configure Basic Settings for NixOS
How To Configure Basic Settings for NixOS
NixOS is a declarative, reproducible, and immutable Linux distribution built around the Nix package manager. Unlike traditional Linux distributions, where system configurations are managed imperatively (by editing files manually), NixOS uses a single configuration file (/etc/nixos/configuration.nix) to define the entire system state.
This makes NixOS ideal for servers, home labs, and developers who want a consistent, reproducible environment.
๐น Key Features of NixOS
๐ Declarative Configuration โ All settings are defined in configuration.nix.
โป๏ธ Rollback Support โ Easily revert changes using generation-based system management.
๐ฆ Atomic Upgrades โ No partial upgrades; everything is built as a complete system.
๐ Reproducibility โ Identical configurations produce identical results on any machine.
๐ Flexible Package Management โ Supports multiple package versions using Nix.
Basic Configuration in NixOS
Since you are running NixOS as a VM in Proxmox with UEFI and Hyprland, hereโs how to configure basic settings like a static IP and installing QEMU guest agent.
1๏ธโฃ Configure a Static IP Address
NixOS manages networking declaratively via configuration.nix.
Steps to Set a Static IP:
Open the configuration file:
sudo nano /etc/nixos/configuration.nix
Add or modify the networking section:
networking = {
useDHCP = false;
interfaces.enp0s18 = {
ipv4.addresses = [
{
address = 192.168.1.100; # Change to your desired IP
prefixLength = 24;
}
];
ipv4.routes = [
{
address = 0.0.0.0;
prefixLength = 0;
via = 192.168.1.1; # Replace with your gateway/router IP
}
];
};
};
Replace enp0s18 with your actual network interface (find it with ip a).
Update the IP, subnet, and gateway based on your network.
Apply the changes:
sudo nixos-rebuild switch
Verify with:
ip a
2๏ธโฃ Install and Enable QEMU Guest Agent
Since youโre running NixOS in Proxmox, you should install the QEMU guest agent to enable features like proper shutdown, memory ballooning, and IP reporting.
Steps to Install and Enable QEMU Guest Agent:
Edit configuration.nix:
sudo nano /etc/nixos/configuration.nix
Add the following under services:
services.qemuGuest.enable = true;
Apply the changes:
sudo nixos-rebuild switch
Check if the guest agent is running:
systemctl status qemu-guest-agent
Resources & Links:
https://nixos.org/manual/nixos/stable/
https://nixos.org/
https://www.proxmox.com/en/
๐ธ Buy me a coffee :
https://buymeacoffee.com/liv4it
๐ธ Support channel & make donation :
https://www.paypal.me/aminenina/10
๐ธ Subscribe for more videos :
Youtube: https://www.youtube.com/user/aminosninatos
๐ธ Follow me On Social Media
Facebook : https://www.facebook.com/aminosninatos/
***********************************************************************
๐ธ How To Install NixOS On Proxmox
https://youtu.be/KRrwJkb1xpk
๐ธ How To Install & Configure Technitium DNS Server on Proxmox
https://youtu.be/m3lNqy3HAvA
๐ธ How To Use The Awesome Linux Bat Command
https://youtu.be/N50jo1gat7M
๐ธ Windows Subsystem for Linux WSL2 Commands
https://youtu.be/mO3Cqb9zYPM
๐ธ This Little Trick Will Prevent You From Messing Up With Your Application Database
https://youtu.be/BdFo21oxKgw
๐ธ PIP The Package Manager for Python
https://youtu.be/aO7o2fMKWx0
๐ธ How to read Crystal Disk Info
https://youtu.be/N3tUXypxNYk
๐ธ How To Monitor the Health of Your Hard Drive in Linux using SMART
https://www.youtube.com/watch?v=z1z9R...
๐ธ Linux iotop: Monitor your disk Input/Output
https://www.youtube.com/watch?v=pWG4v...
๐ธ How To use the โduโ (Disk Usage) Command in Linux
https://www.youtube.com/watch?v=RA4bM...
๐ธ How To Install And Configure CrowdSec on pfSense
https://youtu.be/p4sAHjtboMI
๐ธ How to Install And Configure pfBlockerNG On pfSense
https://youtu.be/AGOcaKijLu4
๐ธ How To Enable Automatic Backups In pfSense
https://youtu.be/mFMKqUvPJFw
๐ธ How To Apply System Patches For pfSense CE (Community Edition)
https://youtu.be/qs4sRnNdpYY
๐ธ How To Setup VLANs on pfSense In Proxmox
https://youtu.be/EpFQD-HtwXk
๐ธ How To Install QEMU Guest Agent On pfSense VM In Proxmox
https://youtu.be/c88-byEL7UM
๐ธHow To Install The worlds most popular workflow automation platform n8n On Proxmox
https://youtu.be/J1cpJRuTHwE
๐ธHow To Setup Notifications On Uptime Kuma a Self Hosted Monitoring Application
https://youtu.be/Cp-rAatifMk
๐ธHow To Install Uptime Kuma a Self Hosted Monitoring Application on Proxmox
https://youtu.be/cCxgkHd0E9Y
๐ธHow To Install Vyos an Amazing Open Source Router On Proxmox
https://youtu.be/dscAQIoDU7w
๐ธHow To Install an SSL Certificate on Proxmox
https://youtu.be/lCkrsaDEiT4
๐ธ How To Lower The Power Use of Proxmox Server
https://youtu.be/FJiEeHmiiH0
๐ธ How To Install Packages on Proxmox VM with Terraform
https://youtu.be/RRJrLTeU67Y
***********************************************************************
#NixOS #proxmox #linux How To Configure Basic Settings for NixOS](https://i.ytimg.com/vi/N4TrEy_A0No/mqdefault.jpg)







