terraformazure-logic-apps

Azure Logic App Error The 'FUNCTIONS_WORKER_RUNTIME' setting is required


I am successfully deployed to Azure (via Terraform) a Standard Logic App based on a Windows 'App Service Plan'.

The Logic App is reporting...

"The 'FUNCTIONS_WORKER_RUNTIME' setting is required. Please specify a valid value. See https://go.microsoft.com/fwlink/?linkid=2257963 for more information. The application will continue to run, but may throw an exception in a future release."

I have checked and this environment value is set and set in the Terraform script...

enter image description here

The Terraform code where the setting is set...

  app_settings = {

    APPINSIGHTS_INSTRUMENTATIONKEY = "${data.azurerm_application_insights.appinsights.instrumentation_key}"

    APPLICATIONINSIGHTS_CONNECTION_STRING = "InstrumentationKey=${data.azurerm_application_insights.appinsights.instrumentation_key};IngestionEndpoint=https://uksouth-0.in.applicationinsights.azure.com/;LiveEndpoint=https://uksouth.livediagnostics.monitor.azure.com/"

    ApplicationInsightsAgent_EXTENSION_VERSION = "~4"

    FUNCTIONS_V2_COMPATIBILITY_MODE = false

    # https://techcommunity.microsoft.com/t5/azure-integration-services-blog/azure-logic-apps-standard-now-supports-azure-functions-v4/ba-p/3656072
    # Not having the below line commented out causes the deployment to fail.
    # FUNCTIONS_EXTENSION_VERSION = "~4"

    # https://learn.microsoft.com/en-us/azure/azure-functions/functions-app-settings#functions_worker_runtime
    FUNCTIONS_WORKER_RUNTIME     = "node" #"dotnet-isolated"
    WEBSITE_NODE_DEFAULT_VERSION = "~18"

    WORKFLOWS_TENANT_ID           = data.azurerm_subscription.current.tenant_id
    WORKFLOWS_SUBSCRIPTION_ID     = data.azurerm_subscription.current.id
    WORKFLOWS_LOCATION_NAME       = "uksouth"
    WORKFLOWS_RESOURCE_GROUP_NAME = local.solution_rg
    WORKFLOWS_MANAGEMENT_BASE_URI = "https://management.azure.com/"

Not sure what I have missed, maybe there's a incorrect mismatch in logic app and app-service-plan values?


Solution

  • To deploy a logic app standard with the node runtime stack, you need to provide FUNCTIONS_WORKER_RUNTIME as node which you already passed. Refer azurerm_logic_app template registry for the same requirement.

    And while deploying a logic app, it is not must needed to provider FUNCTIONS_WORKER_RUNTIME.

    Also, the app setting FUNCTIONS_V2_COMPATIBILITY_MODE is not necessarily needed during the deployment. There might be chance of conflict by passing this setting regarding the version compatibility. Remove it and check if the issue still persists.

    Make sure that you are checking the version compatibility and also azurerm provider if you are using the latest one. (4.1.0)

    Complete terraform code:

    terraform {
      required_providers {
        azurerm = {
          source = "hashicorp/azurerm"
          version = "4.1.0"
        }
      }
    }
    provider "azurerm"{
    features{}
    subscription_id = "xxx"
    }
    resource "azurerm_resource_group" "example" {
      name     = "azure-logic-test-rg"
      location = "West Europe"
    }
    resource "azurerm_storage_account" "example" {
      name                     = "functionsapptestsaj"
      resource_group_name      = azurerm_resource_group.example.name
      location                 = azurerm_resource_group.example.location
      account_tier             = "Standard"
      account_replication_type = "LRS"
    }
    
    resource "azurerm_app_service_plan" "example" {
      name                = "jsernewvice-plan"
      location            = azurerm_resource_group.example.location
      resource_group_name = azurerm_resource_group.example.name
      kind                = "Linux"
      reserved            = true
    
      sku {
        tier = "WorkflowStandard"
        size = "WS1"
      }
    }
    resource "azurerm_application_insights" "example" {
      name                = "tf-testjappinsights"
      location            = azurerm_resource_group.example.location
      resource_group_name = azurerm_resource_group.example.name
      application_type    = "web"
    }
    resource "azurerm_logic_app_standard" "example" {
      name                       = "testjah"
      location                   = azurerm_resource_group.example.location
      resource_group_name        = azurerm_resource_group.example.name
      app_service_plan_id        = azurerm_app_service_plan.example.id
      storage_account_name       = azurerm_storage_account.example.name
      storage_account_access_key = azurerm_storage_account.example.primary_access_key
    
      app_settings = {
        APPINSIGHTS_INSTRUMENTATIONKEY = "${azurerm_application_insights.example.instrumentation_key}"
        APPLICATIONINSIGHTS_CONNECTION_STRING = "InstrumentationKey=${azurerm_application_insights.example.instrumentation_key};IngestionEndpoint=https://uksouth-0.in.applicationinsights.azure.com/;LiveEndpoint=https://uksouth.livediagnostics.monitor.azure.com/"
        ApplicationInsightsAgent_EXTENSION_VERSION = "~4"
        FUNCTIONS_V2_COMPATIBILITY_MODE = false
        "FUNCTIONS_WORKER_RUNTIME"     = "node"
        "WEBSITE_NODE_DEFAULT_VERSION" = "~18"
      }
    }
    

    Deployment succeeded:

    enter image description here

    enter image description here

    enter image description here

    enter image description here