Search code examples
terraformterraform-provider-azureazure-load-balancer

Terraform reports error "invalid or unknown key: load_distribution" when creating a load balancer


I am having the issue for the below terraform code, it reports invalid or unknown key: load_distribution

resource "azurerm_lb_rule" "tf-lbr-erx-interf" {
  resource_group_name            = "${data.azurerm_resource_group.tf-rg-erx-external.name}"
  loadbalancer_id                = "${azurerm_lb.tf-lb-erx-interf.id}"
  name                           = "erx-sha-pre-interf-lbr-01-au-se"
  protocol                       = "Tcp"
  frontend_port                  = "80"
  backend_port                   = "80"
  frontend_ip_configuration_name = "erx-sha-pre-interf-fip-au-se"
  backend_address_pool_id        = "${azurerm_lb_backend_address_pool.tf-lbbp-erx-interf.id}"
  probe_id                       = "${azurerm_lb_probe.tf-lbr-erx-interf.id}"
  load_distribution              = "Client IP"
}

I found the below github url, but no lead https://github.com/hashicorp/terraform/issues/18919

Any idea?


Solution

  • If using 2 tuple Load distribution is your aim, can you try "SourceIP" instead of "Client IP" ?

    load_distribution - (Optional) Specifies the load balancing distribution type to be used by the Load Balancer. Possible values are: Default – The load balancer is configured to use a 5 tuple hash to map traffic to available servers. SourceIP – The load balancer is configured to use a 2 tuple hash to map traffic to available servers. SourceIPProtocol – The load balancer is configured to use a 3 tuple hash to map traffic to available servers. Also known as Session Persistence, where the options are called None, Client IP and Client IP and Protocol respectively.

    Reference: https://www.terraform.io/docs/providers/azurerm/r/loadbalancer_rule.html