Azure Load Balancer NAT Pool

This page shows how to write Terraform and Azure Resource Manager for Load Balancer NAT Pool and write them securely.

azurerm_lb_nat_pool (Terraform)

The NAT Pool in Load Balancer can be configured in Terraform with the resource name azurerm_lb_nat_pool. The following sections describe 10 examples of how to use the resource and its parameters.

Example Usage from GitHub

lb_natpool.tf#L1
resource "azurerm_lb_nat_pool" "lbnatpool1" {
    resource_group_name = azurerm_resource_group.user16-rg.name
    name = "ssh"
    loadbalancer_id = azurerm_lb.user16-lb1.id
    protocol = "Tcp"
    frontend_port_start = 50000
myLBnatpool.tf#L1
resource "azurerm_lb_nat_pool" "lbnatpool" {
    resource_group_name = azurerm_resource_group.user21-rg.name
    name = "ssh"
    loadbalancer_id = azurerm_lb.user21-lb.id
    protocol = "Tcp"
    frontend_port_start = 50000
lb_natpool.tf#L1
resource "azurerm_lb_nat_pool" "lbnatpool" {
    resource_group_name = azurerm_resource_group.user20-rg.name
    name = "ssh"
    loadbalancer_id = azurerm_lb.user20-lb.id
    protocol = "Tcp"
    frontend_port_start = 50000
lb_natpool.tf#L1
resource "azurerm_lb_nat_pool" "lbnatpool" {
    resource_group_name = azurerm_resource_group.user01-rg.name
    name = "ssh"
    loadbalancer_id = azurerm_lb.user01-lb.id
    protocol = "Tcp"
    frontend_port_start = 50000
lb_natpool.tf#L1
resource "azurerm_lb_nat_pool" "lbnatpool" {
    resource_group_name = azurerm_resource_group.user01-rg.name
    name = "ssh"
    loadbalancer_id = azurerm_lb.user01-lb.id
    protocol = "Tcp"
    frontend_port_start = 50000
lb_natpool.tf#L1
resource "azurerm_lb_nat_pool" "lbnatpool" {
    resource_group_name = azurerm_resource_group.user50-rg.name
    name = "ssh"
    loadbalancer_id = azurerm_lb.user50-lb.id
    protocol = "Tcp"
    frontend_port_start = 50000
lb-natpool.tf#L1
resource "azurerm_lb_nat_pool" "lb-natpool" {
        resource_group_name         = azurerm_resource_group.user25-rg.name
    name                = "ssh"
    loadbalancer_id         = azurerm_lb.user25-lb.id
    protocol            = "Tcp"
    frontend_port_start         = 50000
lb_natpool.tf#L1
resource "azurerm_lb_nat_pool" "lbnatpool" {
    resource_group_name = azurerm_resource_group.user01-rg.name
    name = "ssh"
    loadbalancer_id = azurerm_lb.user01-lb.id
    protocol = "Tcp"
    frontend_port_start = 50000
lb_natpool.tf#L1
resource "azurerm_lb_nat_pool" "lbnatpool" {
    resource_group_name = azurerm_resource_group.user01-rg.name
    name = "ssh"
    loadbalancer_id = azurerm_lb.user01-lb.id
    protocol = "Tcp"
    frontend_port_start = 50000
lb_natpool.tf#L1
resource "azurerm_lb_nat_pool" "lbnatpool" {
    resource_group_name = azurerm_resource_group.user16-rg.name
    name = "ssh"
    loadbalancer_id = azurerm_lb.user16-lb.id
    protocol = "Tcp"
    frontend_port_start = 50000

Review your Terraform file for Azure best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

Explanation in Terraform Registry

Manages a Load Balancer NAT pool. -> NOTE: This resource cannot be used with with virtual machines, instead use the azurerm_lb_nat_rule resource.

NOTE When using this resource, the Load Balancer needs to have a FrontEnd IP Configuration Attached

Microsoft.Network/loadBalancers/inboundNatPools (Azure Resource Manager)

The loadBalancers/inboundNatPools in Microsoft.Network can be configured in Azure Resource Manager with the resource name Microsoft.Network/loadBalancers/inboundNatPools. The following sections describe how to use the resource and its parameters.

Example Usage from GitHub

An example could not be found in GitHub.

Frequently asked questions

What is Azure Load Balancer NAT Pool?

Azure Load Balancer NAT Pool is a resource for Load Balancer of Microsoft Azure. Settings can be wrote in Terraform.

Where can I find the example code for the Azure Load Balancer NAT Pool?

For Terraform, the fantasthan/user16, hl3lfb/vmss and ingHHK/azure-demo-proj source code examples are useful. See the Terraform Example section for further details.