terraform/website/source/docs/providers/azurerm/r/loadbalancer.html.markdown

1.9 KiB

layout page_title sidebar_current description
azurerm Azure Resource Manager: azurerm_lb docs-azurerm-resource-loadbalancer Create a LoadBalancer Resource.

azurerm_lb

Create a LoadBalancer Resource.

Example Usage

resource "azurerm_resource_group" "test" {
    name = "LoadBalancerRG"
    location = "West US"
}

resource "azurerm_public_ip" "test" {
    name = "PublicIPForLB"
    location = "West US"
    resource_group_name = "${azurerm_resource_group.test.name}"
    public_ip_address_allocation = "static"
}

resource "azurerm_lb" "test" {
    name = "TestLoadBalancer"
    location = "West US"
    resource_group_name = "${azurerm_resource_group.test.name}"

    frontend_ip_configuration {
      name = "PublicIPAddress"
      public_ip_address_id = "${azurerm_public_ip.test.id}"
    }
}

Argument Reference

The following arguments are supported:

  • name - (Required) Specifies the name of the LoadBalancer.
  • resource_group_name - (Required) The name of the resource group in which to create the LoadBalancer.
  • location - (Required) Specifies the supported Azure location where the resource exists.
  • frontend_ip_configuration - (Optional) A frontend ip configuration block as documented below.
  • tags - (Optional) A mapping of tags to assign to the resource.

frontend_ip_configuration supports the following:

  • name - (Required) Specifies the name of the frontend ip configuration.
  • subnet_id - (Optional) Reference to subnet associated with the IP Configuration.
  • private_ip_address - (Optional) Private IP Address to assign to the Load Balancer. The last one and first four IPs in any range are reserved and cannot be manually assigned.
  • public_ip_address_id - (Optional) Reference to Public IP address to be associated with the Load Balancer.

Attributes Reference

The following attributes are exported:

  • id - The LoadBalancer ID.