Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resource for zip deployment of function app #1376

Closed
arichiardi opened this issue Jun 11, 2018 · 10 comments
Closed

Resource for zip deployment of function app #1376

arichiardi opened this issue Jun 11, 2018 · 10 comments

Comments

@arichiardi
Copy link
Contributor

arichiardi commented Jun 11, 2018

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 😄

New or Affected Resource(s)

  • azurerm_function_app

References

@kevinneufeld
Copy link

kevinneufeld commented Jun 25, 2018

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.

@arichiardi
Copy link
Contributor Author

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.

@MikeNicholls
Copy link

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.

@mikemowgli
Copy link

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.

@njuCZ
Copy link
Contributor

njuCZ commented Sep 14, 2020

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

@mlcooper
Copy link

mlcooper commented Mar 28, 2023

@tombuildsstuff @njuCZ Now that v3.x of azurerm has been out for some time, I would like to re-raise this issue. Currently to do a ZIP Deploy for an Azure function, it either must be done with the az CLI or with the REST API.

I am proposing a new resource parameter to support this natively. For example:

resource "azurerm_<windows/linux>_function_app" "lambda_app" {
...
zip_deploy_file = archive_file.azure_function.output_path
}

Please note this as well:

If your project needs to use remote build, do not use the WEBSITE_RUN_FROM_PACKAGE app setting. Instead add the SCM_DO_BUILD_DURING_DEPLOYMENT=true deployment customization app setting. For Linux, also add the ENABLE_ORYX_BUILD=true setting. To learn more, see Remote build.

@mlcooper
Copy link

It looks like support for ZIP deploy is going to get released in v3.5.0 👍

#20544

@harshavmb
Copy link
Contributor

Hi @mybayern1974 / @rcskosir ,

Could this be closed as it seemed to be supported from v.3.50.0?

@rcskosir
Copy link
Contributor

@harshavmb Thanks for bringing this to my attention. It looks like this has been resolved as of #20544. As such, I am going to mark this issue as closed. If that is not the case, please provide additional information including the version in which you are still experiencing this issue, thanks!

Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

9 participants