It would be awesome if the azure provider would have a resource for the zip deployment described here:
https://docs.microsoft.com/en-us/azure/azure-functions/deployment-zip-push
At the moment the only way to push a zip file to a function app is to use the az tool directly. Blob would not work because, if I understand things correctly - and I am a newbie here - the WEBSITE_RUN_FROM_ZIP that eventually contains the link to the zip has to reference the hostname of the function app, which is a self-reference. At least this is what I tried and it is not working:
resource "azurerm_function_app" "lambda_app" {
...
app_settings = ...
"WEBSITE_RUN_FROM_ZIP" "${azurerm_function_app.lambda_app.default_hostname}/...blob url and sas"
}
It doesn't have to be a resource..or if there is a workaround I would love to know it :smile:
Richard,
Were you able to figure out a deployment method for your Azure Function App?
I would give this a try:
resource "azurerm_function_app" "lambda_app" {
...
app_settings = ...
"WEBSITE_RUN_FROM_ZIP" = "${format("%s.azurewebsites.net/%s", var.fn_app_name, var.blob_url_sas)}"
}
Hope that helps.
I figured it out yes and I was using the exact snippet you posted so thanks. I still think it is a bit unintuitive though.
Using a URL works, but unfortunately is not recommended by Microsoft:
When running a function app on Windows, the external URL option yields worse cold-start performance. When deploying your function app to Windows, you should set
WEBSITE_RUN_FROM_PACKAGEto1and publish with zip deployment.
Correct me if I'm wrong, but (as a complete AzureFunctions newbie) my understanding is that 'Run From Package' and 'Zip Deployment' are not the same thing:
What this GH issue asks for (I think) is a Terraform feature for zip deployment of Functions so that remote build remains available.
After internal discussion with hashicorp maintainers, we would hold on this work until the next major release 3.0. The app service resource will have a large refactoring
Most helpful comment
Using a URL works, but unfortunately is not recommended by Microsoft: