Terraform-provider-azurerm: Resource for zip deployment of function app

Created on 11 Jun 2018  路  5Comments  路  Source: terraform-providers/terraform-provider-azurerm

Community Note

  • Please vote on this issue by adding a 馃憤 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

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:

New or Affected Resource(s)

  • azurerm_function_app

References

  • #1307 (?)
enhancement servicfunctions

Most helpful comment

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_PACKAGE to 1 and publish with zip deployment.

All 5 comments

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_PACKAGE to 1 and 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:

  • 'Zip deployment' is the way of deploying the function to the cloud, but it still allows for remote building (source)
  • 'Run from package' points to the zip file and assumes all dependencies are packages, which means remote build is not an option anymore (source)

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

Was this page helpful?
0 / 5 - 0 ratings