Deploying v2 Azure Functions with Terraform


You would not think this would be super difficult or, at the least Terraform’s documentation would cover such a common use case. But, I found it to be false, so I figured I would share the necessary changes needed.

First, some background – I am using a Terraform script to deploy a variety of Azure resources to support an internal bootcamp I will be giving at West Monroe in August.

Here is the completed Terraform block to deploy the V2 Azure Function:

resource "azurerm_function_app" "main" {
name = "${var.resource-prefix}-analyticsapp"
location = "${azurerm_resource_group.main.location}"
resource_group_name = "${}"
app_service_plan_id = "${}"
storage_connection_string = "${azurerm_storage_account.main.primary_connection_string}"
version = "~2"
app_settings {
site_config {
always_on = true
linux_fx_version = "DOCKER|"
use_32_bit_worker_process = true

view raw

hosted with ❤ by GitHub

This isnt something that is covered in the documentation that, in addition to specifying version we also need to include the linux_fx_version​in site_config.

I do not know if this is necessary if you use a Windows based App Service Plan (I am using Linux and sharing it with my App Service).

I found immense frustration in figuring this out and found myself annoyed that I could not find anything by V1 examples in the Terraform docs.


2 thoughts on “Deploying v2 Azure Functions with Terraform

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s