A terraform module to provide load balancers in Azure with the following characteristics:
Ability to specify public
or private
loadbalancer using: var.type
. Default is public.
Specify subnet to use for the loadbalancer: frontend_subnet_id
For private
loadbalancer, specify the private ip address using frontend_private_ip_address
Specify the type of the private ip address with frontend_private_ip_address_allocation
, Dynamic
or Static
, default is Dynamic
Based of original module: https://github.com/Azure/terraform-azurerm-loadbalancer
It supports creating:
- Public IP
- Load Balancer
- Backend Address Pool
- Nat Rule
- Load Balancer Probe
- Load Balancer Rule
Review the examples folder: examples
Perform the following commands on the root folder:
terraform init
to get the pluginsterraform plan
to see the infrastructure planterraform apply
to apply the infrastructure buildterraform destroy
to destroy the built infrastructure
use terraform-docs to create Inputs and Outpus documentation terraform-docs
terraform-docs markdown .
The following dependencies must be installed on the development system:
Azure
- Terraform Provider for Azure
- CLI Tool az
No requirements.
Name | Version |
---|---|
azurerm | n/a |
No modules.
Name | Type |
---|---|
azurerm_lb.azlb | resource |
azurerm_lb_backend_address_pool.azlb | resource |
azurerm_lb_nat_rule.azlb | resource |
azurerm_lb_probe.azlb | resource |
azurerm_lb_rule.azlb | resource |
azurerm_public_ip.azlb | resource |
azurerm_resource_group.azlb | data source |
Name | Description | Type | Default | Required |
---|---|---|---|---|
allocation_method | (Required) Defines how an IP address is assigned. Options are Static or Dynamic. | string |
"Static" |
no |
frontend_name | (Required) Specifies the name of the frontend ip configuration. | string |
"myPublicIP" |
no |
frontend_private_ip_address | (Optional) Private ip address to assign to frontend. Use it with type = private | string |
"" |
no |
frontend_private_ip_address_allocation | (Optional) Frontend ip allocation type (Static or Dynamic) | string |
"Dynamic" |
no |
frontend_subnet_id | (Optional) Frontend subnet id to use when in private mode | string |
"" |
no |
lb_port | Protocols to be used for lb rules. Format as [frontend_port, protocol, backend_port] | map(any) |
{} |
no |
lb_probe | (Optional) Protocols to be used for lb health probes. Format as [protocol, port, request_path] | map(any) |
{} |
no |
lb_probe_interval | Interval in seconds the load balancer health probe rule does a check | number |
5 |
no |
lb_probe_unhealthy_threshold | Number of times the load balancer health probe has an unsuccessful attempt before considering the endpoint unhealthy. | number |
2 |
no |
lb_sku | (Optional) The SKU of the Azure Load Balancer. Accepted values are Basic and Standard. | string |
"Basic" |
no |
location | (Optional) The location/region where the core network will be created. The full list of Azure regions can be found at https://azure.microsoft.com/regions | string |
"" |
no |
name | (Optional) Name of the load balancer. If it is set, the 'prefix' variable will be ignored. | string |
"" |
no |
pip_name | (Optional) Name of public ip. If it is set, the 'prefix' variable will be ignored. | string |
"" |
no |
pip_sku | (Optional) The SKU of the Azure Public IP. Accepted values are Basic and Standard. | string |
"Basic" |
no |
prefix | (Required) Default prefix to use with your resource names. | string |
"azure_lb" |
no |
remote_port | Protocols to be used for remote vm access. [protocol, backend_port]. Frontend port will be automatically generated starting at 50000 and in the output. | map(any) |
{} |
no |
resource_group_name | (Required) The name of the resource group where the load balancer resources will be imported. | string |
n/a | yes |
tags | n/a | map(string) |
{ |
no |
type | (Optional) Defined if the loadbalancer is private or public | string |
"public" |
no |
Name | Description |
---|---|
azurerm_lb_backend_address_pool_id | the id for the azurerm_lb_backend_address_pool resource |
azurerm_lb_frontend_ip_configuration | the frontend_ip_configuration for the azurerm_lb resource |
azurerm_lb_id | the id for the azurerm_lb resource |
azurerm_lb_nat_rule_ids | the ids for the azurerm_lb_nat_rule resources |
azurerm_lb_probe_ids | the ids for the azurerm_lb_probe resources |
azurerm_public_ip_address | the ip address for the azurerm_lb_public_ip resource |
azurerm_public_ip_id | the id for the azurerm_lb_public_ip resource |
azurerm_resource_group_name | name of the resource group provisioned |
azurerm_resource_group_tags | the tags provided for the resource group |
Refer to the contribution guidelines for information on contributing to this module.