This Terraform configuration sets up an Azure Load Balancer (LB) to distribute traffic among multiple virtual machines (VMs) in a backend pool. It includes configurations for network interfaces, public IP, load balancer, backend pool, health probe, rules, NAT rules, DNS setup, and more.
- Azure CLI installed and configured
- Terraform installed (version >= 0.13)
- Azure subscription
-
Clone this repository:
git clone <repository_url> cd <repository_directory>
-
Initialize Terraform:
terraform init
-
Modify
variables.tf
with your specific configurations. -
Review and apply the Terraform plan:
terraform plan terraform apply
Defines network interfaces for VMs with dynamic private IP allocation.
Static allocation method for the Load Balancer's public IP address.
Standard SKU load balancer with a frontend IP configuration using the allocated public IP.
Defines a backend pool with VMs' private IP addresses.
TCP probe to check VMs' SSH availability on port 22.
TCP rule to forward traffic from port 80 on the Load Balancer to port 80 on backend VMs.
Allows SSH access (port 22) to backend VMs through a range of frontend ports (2200-2300).
Creates a DNS zone and A record to point your domain (www.rimtest.com
) to the Load Balancer's public IP.
- DNS zone name servers for configuring your domain's DNS settings.
To avoid unnecessary charges, destroy the Terraform-managed resources:
terraform destroy
This README provides a structured overview of your Terraform configuration for setting up an Azure Load Balancer. Adjust the content based on your specific project details and requirements.