pulumi / pulumi-azure-native

Azure Native Provider
Apache License 2.0
125 stars 33 forks source link

Azure Load Balancer Backend Pool IP address - python #3601

Open vigor-vavan opened 1 day ago

vigor-vavan commented 1 day ago

What happened?

When creating an Azure Load Balancer using Pulumi with Python, the backend pool is created but remains empty despite providing the necessary data.

We have attempted to populate the backend pool using LoadBalancerBackendAddressArgs, LoadBalancerBackendAddressArgs with a list of dictionaries, but none of these methods have worked. If we create the load balancer in the first iteration and then hardcode the backend values in the next iteration, the backend data is populated correctly.

Pulumi completes the process successfully without any errors, but the backend pool remains empty.

Example

Our codebase is quite large, making it impractical to share the exact code. However, we have tested the plain example from the documentation and encountered the same behavior.

Output of pulumi about

python version 3.11.1 pulumi version 3.134.0

Additional context

We have been using the same code for the past few months without any issues. However, in the last 10 days, it has stopped working. We tried updating the Pulumi version, but the load balancer backend pool remains empty.

Contributing

Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

justinvp commented 1 day ago

Sorry for the trouble, @vigor-vavan. This sounds likely specific to Azure Native, so transferring to that repo and someone will take a look soon.

thomas11 commented 10 hours ago

Hi @vigor-vavan, which load balancer are you using? There's containerservice.LoadBalancer, kuberrnetesruntime.LoadBalancer, and network.LoadBalancer.

Can you also tell us exactly which example from the docs shows the issue? Many resources have several examples.

Lastly, may I ask you to double-check if any dependencies (azure native provider, pulumi) got updated in the past 10 days? Something must have changed for the behavior to change. Thank you!

vigor-vavan commented 9 hours ago

We have been using network.loadbalancer.

I forgot to mention that the preview plan shows the backend address pool will be populated with IPs, but when applied, nothing happens. If we manually add IPs, Pulumi removes them.

Regarding dependencies, we have updated the Pulumi version to test if we will gain any benefit. We upgraded from pulumi version 3.103.0 to version 3.134.0.

We tried using network.LoadBalancerBackendAddressPool, but encountered a circular dependency issue. The load balancer must exist to create the backend pool, and the backend pool must exist to set load balancer rules which are created with load balancer creation. Additionally, it’s not possible to add rules with Azure Native after the load balancer is created.

We have combined example https://www.pulumi.com/registry/packages/azure-native/api-docs/network/loadbalancer/#create-load-balancer with addition of backend pool addresses from https://www.pulumi.com/registry/packages/azure-native/api-docs/network/loadbalancerbackendaddresspool/#update-load-balancer-backend-pool-with-backend-addresses-containing-virtual-network-and--ip-address

We want in one swoop to create load balancer with all resources backend, frontend, health probes, rules.

thomas11 commented 3 hours ago

Hi @vigor-vavan, let me try to clarify a few things.

We tried using network.LoadBalancerBackendAddressPool, but encountered a circular dependency issue.

Above, you wrote your code was working until about 10 days ago. Is that also true for the circular dependency problem? Or was that a different approach?

Additionally, it’s not possible to add rules with Azure Native after the load balancer is created.

Why is that? To my knowledge, it should be possible.

The circular dependency issue is probably solvable via $self. Here is an example in Python.