Load Balancer backend address pool configuration


Im making a load balancer module and i saw on the backend_address_pool resource, theres only a way to create it, but not to assign a scale set or the vms.

resource “azurerm_lb_backend_address_pool” “example” {
resource_group_name = azurerm_resource_group.example.name
loadbalancer_id = azurerm_lb.example.id
name = “acctestpool”

I did some investigation and i found, i can add the vms associating the network interface with the backend pool. I want to know if this is the only way for vms or theres another.

resource “azurerm_network_interface_backend_address_pool_association” “example” {
network_interface_id = azurerm_network_interface.example.id
ip_configuration_name = “testconfiguration1”
backend_address_pool_id = azurerm_lb_backend_address_pool.example.id

For scale sets, i can attach it when i create it with a complete scale set module, following the example, but im not developing an entire scale set module inside the load balancer. I want to know if theres a way to associate it with some of the code or theres another way for this case.

Best Regards