Skip to content

claranet/terraform-azurerm-lb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Azure Load Balancer (L4)

Changelog Notice Apache V2 License OpenTofu Registry

This Terraform module creates an Azure Load Balancer with possible Public IP address and basic NAT.

Global versioning rule for Claranet Azure modules

Module version Terraform version OpenTofu version AzureRM version
>= 8.x.x Unverified 1.8.x >= 4.0
>= 7.x.x 1.3.x >= 3.0
>= 6.x.x 1.x >= 3.0
>= 5.x.x 0.15.x >= 2.0
>= 4.x.x 0.13.x / 0.14.x >= 2.0
>= 3.x.x 0.12.x >= 2.0
>= 2.x.x 0.12.x < 2.0
< 2.x.x 0.11.x < 2.0

Contributing

If you want to contribute to this repository, feel free to use our pre-commit git hook configuration which will help you automatically update and format some files for you by enforcing our Terraform code module best-practices.

More details are available in the CONTRIBUTING.md file.

Usage

This module is optimized to work with the Claranet terraform-wrapper tool which set some terraform variables in the environment needed by this module. More details about variables set by the terraform-wrapper available in the documentation.

⚠️ Since modules version v8.0.0, we do not maintain/check anymore the compatibility with Hashicorp Terraform. Instead, we recommend to use OpenTofu.

module "lb" {
  source  = "claranet/lb/azurerm"
  version = "x.x.x"

  client_name    = var.client_name
  environment    = var.environment
  location       = module.azure_region.location
  location_short = module.azure_region.location_short
  stack          = var.stack

  resource_group_name = module.rg.name

  public_ip_allocated = true
  nat_enabled         = true
}

Providers

Name Version
azurecaf ~> 1.2.28
azurerm ~> 4.0

Modules

No modules.

Resources

Name Type
azurerm_lb.main resource
azurerm_lb_backend_address_pool.main resource
azurerm_lb_outbound_rule.main resource
azurerm_public_ip.main resource
azurecaf_name.default_pool data source
azurecaf_name.lb data source
azurecaf_name.pubip data source

Inputs

Name Description Type Default Required
client_name Client name/account used in naming. string n/a yes
custom_name Name of the Load Balancer, generated if not set. string "" no
default_backend_pool_custom_name Name of the default Load Balancer backend pool, generated if not set. string "" no
default_tags_enabled Option to enable or disable default tags. bool true no
environment Project environment. string n/a yes
extra_tags Extra tags to add on all resources. map(string) {} no
frontend_ip_configurations frontend_ip_configuration blocks as documented (here)[https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/lb#frontend_ip_configuration].
map(object({
subnet_id = string

zones = optional(list(number))

private_ip_address = optional(string)
private_ip_address_allocation = optional(string, "Dynamic")
private_ip_address_version = optional(string, "IPv4")

public_ip_address_id = optional(string)
public_ip_prefix_id = optional(string)

gateway_load_balancer_frontend_ip_configuration_id = optional(string)
}))
{} no
ip_custom_name Name of the Public IP address, generated if not set. string "" no
ip_extra_tags Extra tags to add to the Public IP address. map(string) {} no
lb_extra_tags Extra tags to add to the Load Balancer. map(string) {} no
location Azure location. string n/a yes
location_short Short string for Azure location. string n/a yes
name_prefix Optional prefix for the generated name. string "" no
name_suffix Optional suffix for the generated name. string "" no
nat_allocated_outbound_ports Number of allocated outbound ports for NAT. number 1024 no
nat_enabled True to enable NAT through Load Balancer outbound rules. bool false no
nat_protocol Transport protocol to use for NAT. string "All" no
public_ip_allocated True to allocate a Public IP to the Load Balancer. bool false no
public_ip_allocation_method Allocation method for the Public IP address, can be Static, Dynamic. string "Static" no
public_ip_custom_domain_name_label Label for the Domain Name. Will be used to make up the FQDN. If a domain name label is specified, an A DNS record is created for the public IP in the Microsoft Azure DNS system. Defaults to Load Balancer's name, set null to disable. string "" no
public_ip_sku SKU name for the Public IP address, can be Basic or Standard. string "Standard" no
resource_group_name Resource group name. string n/a yes
sku_name The Name of the SKU used for this Load Balancer. Possible values are Basic and Standard. string "Standard" no
stack Project stack name. string n/a yes
zones Specifies a list of Availability Zones in which the Public IP Address for this Load Balancer should be located. Also used as default for frontend_ip_configuration zones. list(number)
[
1,
2,
3
]
no

Outputs

Name Description
backend_address_pool Load Balancer's default backend address pool resource object.
backend_address_pool_id ID of the associated default backend address pool.
backend_address_pool_ip_configurations IP configurations of the associated default backend address pool.
backend_address_pool_load_balancing_rules Load balancing rules of the associated default backend address pool.
backend_address_pool_name Name of the associated default backend address pool.
frontend_ip_configuration Load Balancer's frontend IP configuration as described here.
id ID of the Load Balancer.
name Name of the Load Balancer.
oubound_rule Load Balancer's default outbound rule resource object if any.
outbound_rule_allocated_outbound_ports Number of allocated oubound ports of the default outbound rule if any.
outbound_rule_id ID of the default outbound rule if any.
outbound_rule_name Name of the default outbound rule if any.
private_ip_address Private IP address of the Load Balancer.
private_ip_addresses Private IP addresses of the Load Balancer.
pubip Public IP address resource object if any.
pubip_domain_name_label Domain name label of the public IP address if any.
pubip_fqdn FQDN of the public IP address if any.
pubip_id ID of the public IP address if any.
pubip_ip_address IP address of the public IP address if any.
resource Load Balancer resource object.

Related documentation

Microsoft Azure documentation: docs.microsoft.com/en-us/azure/load-balancer/