/terraform-azurerm-lb

Terraform module for Azure Load Balancer

Primary LanguageHCLApache License 2.0Apache-2.0

Azure Load Balancer (L4)

Changelog Notice Apache V2 License TF 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 AzureRM version
>= 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

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.

module "azure_region" {
  source  = "claranet/regions/azurerm"
  version = "x.x.x"

  azure_region = var.azure_region
}

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

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

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.resource_group_name

  allocate_public_ip = true
  enable_nat         = true
}

Providers

Name Version
azurecaf ~> 1.1
azurerm ~> 3.0

Modules

No modules.

Resources

Name Type
azurecaf_name.lb resource
azurecaf_name.pubip resource
azurerm_lb.lb resource
azurerm_lb_backend_address_pool.default_pool resource
azurerm_lb_outbound_rule.outbound resource
azurerm_public_ip.ip resource

Inputs

Name Description Type Default Required
allocate_public_ip True to allocate a Public IP to the Load Balancer. bool false no
client_name Client name/account used in naming string n/a yes
default_tags_enabled Option to enable or disable default tags. bool true no
enable_nat True to enable NAT through Load Balancer outbound rules. bool false no
environment Project environment string n/a yes
extra_tags Extra tags to add on all resources. map(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_custom_name Name of the Load Balancer, generated if not set. string "" no
lb_extra_tags Extra tags to add to the Load Balancer. map(string) {} no
lb_frontend_ip_configurations frontend_ip_configuration blocks as documented here: https://www.terraform.io/docs/providers/azurerm/r/lb.html#frontend_ip_configuration map(any) {} 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_protocol Transport protocol to use for NAT. string "All" no
public_ip_allocation_method Allocation method for the Public IP address, can be Static, Dynamic. string "Static" 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
use_caf_naming Use the Azure CAF naming provider to generate default resource name. lb_custom_name override this if set. Legacy default name is used if this is set to false. bool true no

Outputs

Name Description
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 https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/lb#frontend_ip_configuration
lb_id Id of the Load Balancer
lb_name Name of the Load Balancer
lb_private_ip_address Private IP address of the Load Balancer
lb_private_ip_addresses Private IP addresses of the Load Balancer
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
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

Related documentation

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