Function app App Keys not getting generated

Hello Team,

I am trying to create a function app via terraform using the template i have provided below in the git link. Function app is getting created but the app keys are not loading/generated. The function app is not available for deploying functions to it resulting in

Error: Encountered an error (ServiceUnavailable) from host runtime.

template : GitHub - lijink14/terraform_functionapp: Terraform for creating function app in azure cloud

It would be awesome if someone can help me identify the issue here and resolve it, been stuck here for some time.

Thanks in advance.

regards
Lijin

I ran into the same problem. In my case terraform apply was stuck on fetching the keys:

data.azurerm_function_app_host_keys.host_key: Still reading... [20m0s elapsed]

Service returned an error. Status=400 Code="BadRequest" Message="Encountered an error (ServiceUnavailable) from host runtime."

When debugging I found that the function app needs to be able to boot to show the host keys. I found it couldn’t start because there was no package uploaded even though WEBSITE_RUN_FROM_PACKAGE=1 was set. Removing the configuration value made the website startup (with the generic “Your Functions 4.0 app is up and running”), and the host keys were displayed.