Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error thrown CannotMixIPBasedAddressesAndIPConfigurationsOnLoadBalancerBackendAddressPool when using azurerm_network_interface_backend_address_pool_association #25962

Open
1 task done
ashleysommer opened this issue May 14, 2024 · 3 comments

Comments

@ashleysommer
Copy link

ashleysommer commented May 14, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Community Note

  • Please vote on this issue by adding a 👍 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 and review the contribution guide to help.

Terraform Version

1.8.3

AzureRM Provider Version

3.103.1

Affected Resource(s)/Data Source(s)

azurerm_network_interface_backend_address_pool_association

Terraform Configuration Files

This Gist shows a minimal reproduction of the error:
https://gist.github.com/ashleysommer/7a9d62eb3dbc770118e95d4d963da940

Debug Output/Panic Output

Error: updating Backend Address Pool Association for Network Interface: (Name "nic-1" / Resource Group "minimal_rg"): network.InterfacesClient#CreateOrUpdate: Failure sending request: StatusCode=400 -- Original Error: Code="CannotMixIPBasedAddressesAndIPConfigurationsOnLoadBalancerBackendAddressPool" Message="Mixing backend ipconfigurations and IPAddresses in backend pool /subscriptions/f9226acc-94d1-46a8-af99-88fb2757df4a/resourceGroups/minimal_rg/providers/Microsoft.Network/loadBalancers/lb-1/backendAddressPools/lb-backend-pool-1 is not allowed." Details=[]

│   with azurerm_network_interface_backend_address_pool_association.my_nic_address_pool,
│   on main.tf line 132, in resource "azurerm_network_interface_backend_address_pool_association" "my_nic_address_pool":
│  132: resource "azurerm_network_interface_backend_address_pool_association" "my_nic_address_pool" {

This Gist contains the relevant debug output:
https://gist.github.com/ashleysommer/4a6767bd3b774eebb2b3f7718926e850

Expected Behaviour

I'm trying to assign my VM's NIC to a Load-Balancer Backend Address Pool using azurerm_network_interface_backend_address_pool_association, I followed the docs for azurerm_network_interface_backend_address_pool_association as well as other example implementations and guides, I believe I've configured it correctly.

Actual Behaviour

Azure fails to associate the NIC to the Load-balancer's Backend Address Pool.

Code="CannotMixIPBasedAddressesAndIPConfigurationsOnLoadBalancerBackendAddressPool" Message="Mixing backend ipconfigurations and IPAddresses in backend pool /subscriptions/f9226acc-94d1-46a8-af99-88fb2757df4a/resourceGroups/minimal_rg/providers/Microsoft.Network/loadBalancers/lb-1/backendAddressPools/lb-backend-pool-1 is not allowed."

The error indicates mixing IP-based addresses and IP Configurations on the LoadBalancer Backend Address Pool, however notice in the example I'm only adding a single item, that is a NIC IP Configuration to the Backend Address Pool.

Steps to Reproduce

Use minimal reproduction supplied, run terraform apply .

Important Factoids

No response

References

Seems like a recent issue with the Azure backend? Searching google for "CannotMixIPBasedAddressesAndIPConfigurationsOnLoadBalancerBackendAddressPool" only shows hits starting from the last 48 hours. Searching this issue tracker and other issue trackers shows no reference to this error being reported before.

This may be fixed by #25959 ?

@rcskosir
Copy link
Contributor

Thank you for taking the time to open this issue. #25959 has been merged and should be released soon, if you're able to upgrade once it is released and let us know if this issue is resolved that would be much appreciated!

@ashleysommer
Copy link
Author

ashleysommer commented May 17, 2024

@rcskosir
I've just upgraded to release v3.104.0, which contains the changes from #25959 and I'm still seeing the same error as in the initial report.

CannotMixIPBasedAddressesAndIPConfigurationsOnLoadBalancerBackendAddressPool: Mixing backend ipconfigurations and IPAddresses in backend pool

For what its worth, I also downgraded to v3.85.0 yesterday to see if that helps, and I'm seeing the same error on that version too.

This could well still be something wrong with my understanding of how to use azurerm_network_interface_backend_address_pool_association (as seen in my provided terraform files), but I'm struggling to see where my mistake is, it should be a straightforward operation.

@ashleysommer
Copy link
Author

@rcskosir
I found that if I remove the virtual_network_id from my lb_backend_address_pool then my problem resolves itself.

I was wondering why virtual_network_id is an "optional" attribute, and it seems that if you specify a virtual_network_id on the lb_backend_address_pool then it puts the address pool in "IPAddress" mode. But if you don't supply the virtual_network_id, then the pool allows you to add NIC IPConfiguration Associations as I wanted.

resource "azurerm_lb_backend_address_pool" "my_lb_backend_pool" {
  name                = "lb-backend-pool-1"
  loadbalancer_id     = azurerm_lb.my_lb.id
  #virtual_network_id  = azurerm_virtual_network.my_vnet.id  <-- remove this
}

I wonder if this is a recent change, or has always been like that? Does it need to be put in the documentation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants