title: Terraform Azure 2xLinux VM with httpd + LoadBalancer not working
body: <p>I am trying to create a Terraform PoC that has two centos VMs and an Azure Load Balancer. <br />
  Each VM has one private and one public IP and installed the httpd package.<br />
  Even the elements are provisioned successful, accessing the Public IP of the Load Balancer does not return the default httpd content (inside the CentOS VM curl localhost or the IP returns the correct content).
  No firewall enabled on CentOS. <br />
  Below it the Terraform file. (Location i am using is westeurope).</p>
  <p><strong>Q:</strong> What am I missing in the configuration for the Load Balancer? All items are provisioned, no error from terraform, when accessing the public ip of the load balancer I get time out instead of the default apache page.</p>
  <pre><code>resource &quot;azurerm_resource_group&quot; &quot;test&quot; {
    name     = var.rg_name
    location = var.location
      tags = {
      Owner       = var.tags[&quot;Owner&quot;]
      Environment = var.tags[&quot;Environment&quot;]
    }
  }
  
  
  resource &quot;azurerm_virtual_network&quot; &quot;test&quot; {
   name                = var.vnet_name
   address_space       = [&quot;192.168.0.0/16&quot;]
   location            = azurerm_resource_group.test.location
   resource_group_name = azurerm_resource_group.test.name
      tags = {
      Owner       = var.tags[&quot;Owner&quot;]
      Environment = var.tags[&quot;Environment&quot;]
    }
  }
  
  resource &quot;azurerm_subnet&quot; &quot;test&quot; {
   name                 = var.networks[&quot;subnet1&quot;]
   resource_group_name  = azurerm_resource_group.test.name
   virtual_network_name = azurerm_virtual_network.test.name
   address_prefixes      = [&quot;192.168.0.0/24&quot;]
  }
  
  resource &quot;azurerm_public_ip&quot; &quot;testlb&quot; {
   name                         = &quot;tf-demo-publicIPForLB&quot;
   location                     = azurerm_resource_group.test.location
   resource_group_name          = azurerm_resource_group.test.name
   sku                          = &quot;Standard&quot;
   allocation_method            = &quot;Static&quot;
   domain_name_label            = &quot;acndemo&quot;
      tags = {
      Owner       = var.tags[&quot;Owner&quot;]
      Environment = var.tags[&quot;Environment&quot;]
    }
  }
  
  resource &quot;azurerm_lb&quot; &quot;test&quot; {
   name                = &quot;tf-demo-loadBalancer&quot;
   location            = azurerm_resource_group.test.location
   resource_group_name = azurerm_resource_group.test.name
   sku                 = &quot;Standard&quot;
   frontend_ip_configuration {
     name                 = &quot;tf-demo-lb-publicIPAddress&quot;
     public_ip_address_id = azurerm_public_ip.testlb.id
   }
      tags = {
      Owner       = var.tags[&quot;Owner&quot;]
      Environment = var.tags[&quot;Environment&quot;]
    }
  }
  
  
  resource &quot;azurerm_lb_backend_address_pool&quot; &quot;test&quot; {
   loadbalancer_id     = azurerm_lb.test.id
   name                = &quot;tf-demo-BackEndAddressPool&quot;
  }
  
  
  resource &quot;azurerm_network_interface_backend_address_pool_association&quot; &quot;test&quot; {
    count = 2
    network_interface_id    = &quot;${azurerm_network_interface.test[count.index].id}&quot;
    ip_configuration_name   = &quot;tf-demo-nic-config${count.index}&quot;
    backend_address_pool_id = azurerm_lb_backend_address_pool.test.id
  }
  
  resource &quot;azurerm_lb_probe&quot; &quot;test&quot; {
    resource_group_name = azurerm_resource_group.test.name
    loadbalancer_id     = azurerm_lb.test.id
    name                = &quot;tf-demo-http-running-probe&quot;
    protocol            = &quot;Http&quot;
    port                = 80
    request_path        = &quot;/&quot;
  }
  
  resource &quot;azurerm_lb_rule&quot; &quot;test&quot; {
    resource_group_name            = azurerm_resource_group.test.name
    loadbalancer_id                = azurerm_lb.test.id
    name                           = &quot;tf-demo-LBRule&quot;
    protocol                       = &quot;Tcp&quot;
    frontend_port                  = 80
    backend_port                   = 80
    frontend_ip_configuration_name = &quot;tf-demo-lb-publicIPAddress&quot;
    backend_address_pool_id        = azurerm_lb_backend_address_pool.test.id
    probe_id                       = azurerm_lb_probe.test.id
  }
  
  
  resource &quot;azurerm_public_ip&quot; &quot;test&quot; {
   count                        = 2
   name                         = &quot;tf-demo-publicIPForVM${count.index}&quot;
   location                     = azurerm_resource_group.test.location
   resource_group_name          = azurerm_resource_group.test.name
   sku                          = &quot;Standard&quot;
   allocation_method            = &quot;Static&quot;
   domain_name_label            = &quot;acngrvm${count.index}&quot;
   tags = {
      Owner       = var.tags[&quot;Owner&quot;]
      Environment = var.tags[&quot;Environment&quot;]
    }
  }
  
  
  
  resource &quot;azurerm_network_interface&quot; &quot;test&quot; {
   count               = 2
   name                = &quot;tf-demo-nic${count.index}&quot;
   location            = azurerm_resource_group.test.location
   resource_group_name = azurerm_resource_group.test.name
  
   ip_configuration {
     name                          = &quot;tf-demo-nic-config${count.index}&quot;
     subnet_id                     = azurerm_subnet.test.id
     private_ip_address_allocation = &quot;dynamic&quot;
     public_ip_address_id          = &quot;${azurerm_public_ip.test[count.index].id}&quot;
   }
      tags = {
      Owner       = var.tags[&quot;Owner&quot;]
      Environment = var.tags[&quot;Environment&quot;]
    }
  }
  
  
  resource &quot;azurerm_network_security_group&quot; &quot;test&quot; {
      name                = &quot;tf-demo-vm-nsg&quot;
      location            = azurerm_resource_group.test.location
      resource_group_name = azurerm_resource_group.test.name
  
      security_rule {
          name                       = &quot;SSH&quot;
          priority                   = 1001
          direction                  = &quot;Inbound&quot;
          access                     = &quot;Allow&quot;
          protocol                   = &quot;Tcp&quot;
          source_port_range          = &quot;*&quot;
          destination_port_range     = &quot;22&quot;
          source_address_prefix      = &quot;*&quot;
          destination_address_prefix = &quot;*&quot;
      }
      tags = {
      Owner       = var.tags[&quot;Owner&quot;]
      Environment = var.tags[&quot;Environment&quot;]
    }
  }
  
  resource &quot;azurerm_network_interface_security_group_association&quot; &quot;test&quot; {
      count = length(azurerm_network_interface.test)
      network_interface_id      = &quot;${azurerm_network_interface.test[count.index].id}&quot;
      network_security_group_id = azurerm_network_security_group.test.id
  }
  
  resource &quot;azurerm_availability_set&quot; &quot;test&quot; {
   name                         = &quot;tf-demo-availabilityset&quot;
   location                     = azurerm_resource_group.test.location
   resource_group_name          = azurerm_resource_group.test.name
   platform_fault_domain_count  = 2
   platform_update_domain_count = 2
   managed                      = true
      tags = {
      Owner       = var.tags[&quot;Owner&quot;]
      Environment = var.tags[&quot;Environment&quot;]
    }
  }
  
  
  
  
  resource &quot;azurerm_linux_virtual_machine&quot; &quot;test&quot; {
      count                   = 2
      name                    = &quot;tfdemovm${count.index}&quot;
      location                = azurerm_resource_group.test.location
      resource_group_name     = azurerm_resource_group.test.name
      network_interface_ids   = [azurerm_network_interface.test[count.index].id]
      size                    = &quot;Standard_DS1_v2&quot;
      admin_username          = &quot;centos&quot;
      computer_name           = &quot;tfdemovm${count.index}&quot;
      availability_set_id     = azurerm_availability_set.test.id
  
          admin_ssh_key {
      username   = &quot;centos&quot;
      public_key = file(&quot;~/.ssh/id_rsa.pub&quot;)
          }
  
      os_disk {
          name                    = &quot;tfdemovm${count.index}_OsDisk${count.index}&quot;
          caching                 = &quot;ReadWrite&quot;
          storage_account_type    = &quot;Standard_LRS&quot;
      }
  
      source_image_reference {
          publisher = &quot;OpenLogic&quot;
          offer     = &quot;CentOS&quot;
          sku       = &quot;7_8-gen2&quot;
          version   = &quot;latest&quot;
     }
      tags = {
      Owner       = var.tags[&quot;Owner&quot;]
      Environment = var.tags[&quot;Environment&quot;]
    }
  
  }
  
  </code></pre>