'How to add Health Probe id TO LB Rule while creating using Terraform

I am trying to add a LB Rule using Terraform but unable to find a way to refer existing probe id ( Health Probe). Below is my code.

resource "azurerm_lb_rule" "lb-rules" {
  resource_group_name            = var.lb_rg
  loadbalancer_id                = data.azurerm_lb.lb.id
  name                           = var.LB_Rule_Name
  protocol                       = var.protocol
  frontend_port                  = var.frontend_port
  backend_port                   = var.backend_port
  frontend_ip_configuration_name = var.frontend_ip_configuration_name
  backend_address_pool_ids = [data.azurerm_lb_backend_address_pool.backend.id]
 }


Solution 1:[1]

From azurerm provider docs:

The following arguments are supported:

...

probe_id - (Optional) A reference to a Probe used by this Load Balancing Rule.

Therefore:

resource "azurerm_lb_rule" "lb-rules" {
    [...]
    probe_id = azurerm_lb_probe.your_probe.id
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Kombajn zbo?owy