-1

I have 5 FunctionApps with One AppServicePlan[Premium] . One VNET with one subnet already there[Not to be created], which to be used with FunctionApp along with storage.

When I try with azurerm_app_service_virtual_network_swift_connection it can not integrate all funcion apps.

Any solution for same or may be any code example link.

https://discuss.hashicorp.com/t/multiple-functionapp-on-single-appserviceplan-vnet-integration/43022?u=mukteswarp

2 Answers2

0

This is the sample template for function app deployment via terraform. Please review your template with the sample template to see if there are any differences

https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/app_service_virtual_network_swift_connection#example-usage-with-function-app

0

if you have 5 function apps that are already created, then you should pull your data and iterate for each to do the entire association.

This is an example of how I would do it if I were to create a list of 1-2-3-4-5-6 or 110 function apps. where linux_app_name is the list of names -> type (list) , the reason why I did it in a local is because I'm checking before to see if it's empty or not. then for each app service id , doing the azurerm linux function app each key.id and of course the subnet that you're interested in.

Ensure you're putting the correct format of each value in the resource block. This serves purely as an example:

resource "azurerm_app_service_virtual_network_swift_connection" "funclinux" {
  for_each       = toset(local.linux_app_name)
  app_service_id = azurerm_linux_function_app.linuxfunction[each.key].id
  subnet_id      = subnetid
}
halfer
  • 19,824
  • 17
  • 99
  • 186