This Terraform module creates and manages Azure Load Balancers and their associated resources.
- Create multiple Azure Load Balancers
- Configure frontend IP configurations
- Create backend address pools
- Set up NAT pools and rules
- Configure outbound rules
- Define load balancer rules
module "load_balancer" {
source = "github.com/your-org/terraform-azurerm-lb"
lbs = [
{
name = "example-lb"
rg_name = "example-rg"
location = "uksouth"
tags = { Environment = "Production" }
sku = "Standard"
sku_tier = "Regional"
frontend_ip_configuration = [
{
name = "frontend-ip"
zones = [1, 2, 3]
public_ip_address_id = azurerm_public_ip.example.id
private_ip_address_allocation = "Dynamic"
}
]
backend_address_pools = [
{
name = "backend-pool"
}
]
lb_rules = [
{
name = "http"
protocol = "Tcp"
frontend_port = 80
backend_port = 80
}
]
}
]
}No requirements.
| Name | Version |
|---|---|
| azurerm | n/a |
No modules.
| Name | Type |
|---|---|
| azurerm_lb.this | resource |
| azurerm_lb_backend_address_pool.this | resource |
| azurerm_lb_nat_pool.this | resource |
| azurerm_lb_nat_rule.this | resource |
| azurerm_lb_outbound_rule.this | resource |
| azurerm_lb_rule.this | resource |
| Name | Description | Type | Default | Required |
|---|---|---|---|---|
| lbs | A list of LBs to make | list(object({ |
n/a | yes |
| Name | Description |
|---|---|
| lb_backend_address_pool_backend_ip_configurations | Map of _ → list of Backend IP Configuration IDs. |
| lb_backend_address_pool_inbound_nat_rules | Map of _ → list of Inbound NAT Rule IDs. |
| lb_backend_address_pool_load_balancing_rules | Map of _ → list of Load-Balancing Rule IDs. |
| lb_backend_address_pool_outbound_rules | Map of _ → list of Outbound Rule IDs. |
| lb_frontend_ip_configuration | Flattened view of every frontend_ip_configuration on every Load Balancer, including all attributes exported by the provider. |
| lb_id | Load Balancer resource IDs. |
| lb_name | Load Balancer names. |
| lb_nat_rule_ids | Map of _ → NAT-rule ID. |
| lb_nat_rule_names | Map of _ → NAT-rule name. |
| lb_private_ip_address | First private IP address on each Load Balancer (first frontend config only). |
| lb_private_ip_addresses | List of all private IPs (across all frontend configs) on each Load Balancer. |
| lb_rule_ids | Map of _ → azurerm_lb_rule ID. |
| lb_rule_names | Map of _ → azurerm_lb_rule name. |