title: How to add a backend with virtual machine IP for Azure Load Balancer in Terraform
body: <p>I am creating an Azure load balancer that I need to route the incoming traffic to backend pool which consist of a virtual machine.</p>
  <p>I am using Terraform to do this.</p>
  <p>So far, I have created the followings:</p>
  <ol>
  <li>Load Balancer</li>
  <li>Load Balancer Rule</li>
  <li>Backend Address Pool</li>
  <li>A health probe</li>
  </ol>
  <p>But in the <code>terraform</code> for backend, there's no way I can setup the IP address of the VM.</p>
  <p>Here's my code. How can I do this?</p>
  <pre><code>resource &quot;azurerm_lb&quot; &quot;example&quot; {
    name                = &quot;TestLoadBalancer&quot;
    resource_group_name = azurerm_resource_group.example.name
    location            = azurerm_resource_group.example.location
    sku                 = &quot;Standard&quot;
  
    frontend_ip_configuration {
      name                          = &quot;classiclb&quot;
      subnet_id                     = azurerm_subnet.vm.id
      private_ip_address_allocation = &quot;Dynamic&quot;
    }
  }
  
  resource &quot;azurerm_lb_backend_address_pool&quot; &quot;example&quot; {
    loadbalancer_id = azurerm_lb.example.id
    name            = &quot;classiclb&quot;
  }
  
  resource &quot;azurerm_lb_probe&quot; &quot;example&quot; {
    resource_group_name = azurerm_resource_group.example.name
    loadbalancer_id     = azurerm_lb.example.id
    name                = &quot;classiclb&quot;
    port                = 80
    interval_in_seconds = 10
    number_of_probes    = 3
    protocol            = &quot;Http&quot;
    request_path        = &quot;/&quot;
  }
  
  resource &quot;azurerm_lb_rule&quot; &quot;example&quot; {
    resource_group_name            = azurerm_resource_group.example.name
    loadbalancer_id                = azurerm_lb.example.id
    name                           = &quot;classiclb&quot;
    protocol                       = &quot;Tcp&quot;
    frontend_port                  = 80
    backend_port                   = 80
    frontend_ip_configuration_name = &quot;classiclb&quot;
    backend_address_pool_id        = azurerm_lb_backend_address_pool.example.id
    probe_id                       = azurerm_lb_probe.example.id
  }
  </code></pre>