F5Networks / terraform-azure-bigip-module

Terraform module for Deploying BIG-IP in azure
Apache License 2.0
9 stars 23 forks source link

using for_each vs Count #59

Closed letmetechyou closed 11 months ago

letmetechyou commented 1 year ago

If wanting to build multiple bigips with the external interface having a static ip in azure this module doesnt seem to be setup to work like that. Is there a reason it uses count vs for_each. Is there a way to use for_each and still use static ips on the external nic

letmetechyou commented 1 year ago

any update on this. was curious as to why the module used count vs for_each

pgouband commented 1 year ago

Hi @letmetechyou,

Can you share the Terraform files of what you're trying to do?

letmetechyou commented 1 year ago
module bigip {
  for_each = local.f5_vm_names
  source                      = "F5Networks/bigip-module/azure"
  vm_name                     = each.value
  f5_image_name               = var.image_name
  f5_instance_type            = var.instance_type
  f5_product_name             = var.product
  f5_version                  = var.bigip_version
  enable_ssh_key              = true
  prefix                      = each.value
  f5_ssh_publickey            = data.azurerm_key_vault_key.main.public_key_openssh
  resource_group_name         = var.existing_resource_group_name
  mgmt_subnet_ids             = [{"subnet_id" = data.azurerm_subnet.subnet-mgmt.id, "public_ip" = false, "private_ip_primary" = local.f5_mgmt_nic_ips[each.key] }]
  mgmt_securitygroup_ids      = [module.mgmt-network-security-group.network_security_group_id] 
  external_subnet_ids         = [{"subnet_id" =  data.azurerm_subnet.subnet-ext.id, "public_ip" = true, "private_ip_primary" = local.f5_ext_nic_ips[each.key] , private_ip_secondary = ""}]
  external_securitygroup_ids  = [module.external-network-security-group.network_security_group_id]
  availability_zone           = "1"
}

I'm trying to utilize this module but I was wondering if a for_each if possible since in the code it uses count. We set static ips on our external subnet ip's and noticed the documentation said for_each wouldnt be possible and was wondering if there was a specific reason the module used count vs for_each. I also need to be able to reference the interface id's for another resources but the outputs dont provide that. Would these be things i would need to pull the module down and make modifications myself.

letmetechyou commented 1 year ago

any update

pgouband commented 1 year ago

Hi,

Thanks for reporting. Added to the backlog and internal tracking ID for this request is: INFRAANO-1362.

RavinderReddyF5 commented 1 year ago

Hi @letmetechyou, Are you not able to use count on module ? you should be use count on module and pass the required values based on count.index

pgouband commented 11 months ago

Hi @letmetechyou,

We didn't get any feedback from our last message so we are closing this issue. Please reopen a new one if you are still facing the issue.