terraform-azurerm-caf
terraform-azurerm-caf copied to clipboard
Bug report-Load balancer with multiple frontend IP addresses
Is there an existing issue for this?
- [X] I have searched the existing issues
Community Note
- Please vote on this issue by adding a :thumbsup: reaction to the original issue to help the community and maintainers prioritize this request
- Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment
Version of the module you are using
5.7.6
Rover Version
n/a
Terraform Version
1.5.7
AzureRM Provider Version
3.75.0
Affected Resource(s)/Data Source(s)
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/lb
Terraform Configuration Files
# The load balancer configuration without RG, vNet, VM's, KV, health probes ...
lb = {
lb_lb_001 = {
name = "loadbalancer-example"
resource_group_key = "rg_lb_001"
frontend_ip_configuration = {
fipc_001 = {
name = "loadbalancer-example-001"
subnet = {
vnet_key = "vnet_lb_001"
key = "snet_lb_001"
}
private_ip_address_allocation = "Static"
private_ip_address = "192.168.1.10"
}
fipc_002 = {
name = "loadbalancer-example-002"
subnet = {
vnet_key = "vnet_lb_001"
key = "snet_lb_001"
}
private_ip_address_allocation = "Static"
private_ip_address = "192.168.1.15"
}
}
sku = "Standard"
}
}
Expected Behaviour
It should be possible to add more than one frontend IP address configuration with unique names, but we will get an error (see "Actual Behaviour").
Actual Behaviour
If we add more than one frontend IP address configuration, then we receive the following error:
_Error: Missing required argument
with module.caf.module.lb["lb_lb_001"].azurerm_lb.lb, on .terraform/modules/caf/modules/networking/lb/module.tf line 13, in resource "azurerm_lb" "lb": 13: name = azurecaf_name.lb.result
The argument "frontend_ip_configuration.0.name" is required, but no definition was found._
If we add only one frontend ip address with the code below, then we don't get an error, but this doesn't help us because we need two frontend IP addresses:
lb = { lb_lb_001 = { name = "loadbalancer-example" resource_group_key = "rg_lb_001" frontend_ip_configuration = { name = "loadbalancer-example-001" subnet = { vnet_key = "vnet_lb_001" key = "snet_lb_001" } private_ip_address_allocation = "Static" private_ip_address = "192.168.1.10" } sku = "Standard" } }
Steps to Reproduce
Try to configure more than one frontend ip address for the load balancer and run terraform plan.
We checked the "module.tf" file (main/modules/networking/lb/module.tf) for the load balancer and modified line 18 a bit. If we use
for_each = try(var.settings.frontend_ip_configuration, null)
instead of
for_each = try(var.settings.frontend_ip_configuration, null) != null ? [var.settings.frontend_ip_configuration] : []
then we can configure more than one frontend IP address and don't get an error.
Could you please take a look at this? The load balancer should be configurable with multiple frontend IP addresses. It's possible in the portal.
Thank you!
Important Factoids
n/a
References
No response
+1