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

list to string migration in loadbalancer backend pools #2172

Closed
mbrancato opened this issue Oct 29, 2018 · 5 comments
Closed

list to string migration in loadbalancer backend pools #2172

mbrancato opened this issue Oct 29, 2018 · 5 comments

Comments

@mbrancato
Copy link

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

Terraform Version

Terraform v0.11.10
+ provider.azurerm v1.17.0
+ provider.random v1.3.1
+ provider.template v1.0.0

Affected Resource(s)

  • azurerm_network_interface
  • azurerm_network_interface_backend_address_pool_association

Terraform Configuration Files

I have a module with now deprecated code like this:

resource "azurerm_network_interface" "vm" {
  count                     = "${var.nb_instances}"
  name                      = "${var.vm_hostname}-${count.index}-nic"
  location                  = "${var.location}"
  resource_group_name       = "${var.resource_group_name}"
  network_security_group_id = "${azurerm_network_security_group.vm.id}"

  ip_configuration {
    name                          = "ipconfig${count.index}"
    subnet_id                     = "${var.vnet_subnet_id}"
    private_ip_address_allocation = "Dynamic"
    load_balancer_backend_address_pools_ids = ["${var.lb_backend_pool_ids}"]
  }
}

Expected Behavior

I want to be able to do the following to migrate to the new pool association resource.

resource "azurerm_network_interface_backend_address_pool_association" "vm" {
  count                    = "${var.nb_instances}"
  network_interface_id     = "${element(azurerm_network_interface.vm.*.id,count.index)}"
  ip_configuration_name    = "ipconfig${count.index}"
  backend_address_pool_ids = ["${var.lb_backend_pool_ids}"]
}

Actual Behavior

The azurerm_network_interface_backend_address_pool_association resource however has moved to a string for singular backend pools, and does not allow a list to be provided. This normally in other code would need a nested loop, but we don't have that here. There is probably a way with some creative math (${var.nb_instances * length(var.lb_backend_pool_ids)} etc.) to accomplish this, but that seems overly complex.

Steps to Reproduce

  1. terraform apply

References

@tombuildsstuff tombuildsstuff modified the milestones: v2.0.0, v2.1.0 Feb 14, 2020
@tombuildsstuff tombuildsstuff modified the milestones: v2.1.0, v2.3.0 Mar 10, 2020
@tombuildsstuff tombuildsstuff modified the milestones: v2.3.0, v2.5.0 Mar 24, 2020
@tombuildsstuff tombuildsstuff modified the milestones: v2.5.0, v2.7.0 Apr 7, 2020
@katbyte katbyte modified the milestones: v2.7.0, v2.8.0 Apr 23, 2020
@katbyte katbyte modified the milestones: v2.8.0, v2.9.0 Apr 30, 2020
@tombuildsstuff tombuildsstuff modified the milestones: v2.9.0, v2.11.0 May 4, 2020
@katbyte katbyte modified the milestones: v2.11.0, v2.12.0 May 22, 2020
@tombuildsstuff tombuildsstuff removed this from the v2.12.0 milestone May 27, 2020
@magodo magodo self-assigned this Jun 8, 2020
@magodo
Copy link
Collaborator

magodo commented Jun 10, 2020

@mbrancato Thank you for this issue!
Unfortunately, terraform core doesn't correctly model count = X * Y resources, whilst it should.
I hope you don't mind that I close this issue for now.

@magodo magodo closed this as completed Jun 10, 2020
@mbrancato
Copy link
Author

@magodo To be clear (and I know this code is old), it has nothing to do with the count field or multiplication.

@magodo
Copy link
Collaborator

magodo commented Jun 10, 2020

From your config, I assume you want to bind the same list of the backend pool id to multiple nic, in which case it is a X*Y cases, which is not supported by core for now.

@mbrancato
Copy link
Author

@magodo no, that was not the intent. The original config is mapping a list of backend pools to a single interface. This list is already built, there is no recursion / looping in core needed here AFAIK.

In the migration from azurerm_network_interface to breaking out azurerm_network_interface_backend_address_pool_association as a separate resource, the field load_balancer_backend_address_pools_ids was a list and supported multiple backend address pools and become backend_address_pool_id as a string representing a single backend pool.

@ghost
Copy link

ghost commented Jul 10, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!

@ghost ghost locked and limited conversation to collaborators Jul 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants