F5Networks / terraform-azure-bigip-module

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

"external_public_nic" - additional output to the bigip-module #62

Open dfs5 opened 9 months ago

dfs5 commented 9 months ago

Can we have an additional output added to the bigip-module which would allow to assign the BIG-IP VE secondary IP as pool member to ALB. I tried the workaround as mentioned here but it didn't work: https://github.com/F5Networks/terraform-azure-bigip-module/issues/29

│ Error: Error: Network Interface (Subscription: "3ab97c04-ca68-41d4-8b83-2b9cf0723c23" │ Resource Group Name: "dfsarag-rg-1b8b" │ Network Interface Name: "dfsarag-16db-ext-nic-public-0") was not found │ │   with data.azurerm_network_interface.bigip2-ext, │   on bigip.tf line 196, in data "azurerm_network_interface" "bigip2-ext": │  196: data "azurerm_network_interface" "bigip2-ext" {


What needs to be added:

To be added under .terraform/modules/bigip/outputs.tf

output "external_public_nic" { value = azurerm_network_interface.external_public_nic[0].id }

What the modification would allow:

Then if ALB should front-end the BIG-IP the "external_public_nic" could be associate to the ALB Pool under bigip.tf

Associate the BIG-IP NIC to the ALB backend pool

resource "azurerm_network_interface_backend_address_pool_association" "f5vm01" { network_interface_id = module.bigip.external_public_nic ip_configuration_name = format("%s-secondary-ext-public-ip-0", element(split("-mgmt-0", element(split(".", module.bigip.mgmtPublicDNS), 0)), 0)) backend_address_pool_id = azurerm_lb_backend_address_pool.backend_pool.id }

pgouband commented 8 months ago

Hi @dfs5,

Did you test with the latest version?

dfs5 commented 5 months ago

I am using:

terraform version Terraform v1.3.8 on darwin_amd64


from the docs:

This module is supported from Terraform 0.13 version onwards.

Below templates are tested and worked in the following version

Terraform v0.14.0

provider registry.terraform.io/hashicorp/azurerm v2.28.0 provider registry.terraform.io/hashicorp/null v2.1.2 provider registry.terraform.io/hashicorp/random v2.3.0 provider registry.terraform.io/hashicorp/template v2.1.2 !> Note: bigip-module v1.2.0 Requires azurerm > 3.0 version