In the Azure Portal I can set the Java Version like follows: portal image
In the terraform config file I can only set the Azure Function version using:
resource "azurerm_function_app" "function-app" {
name = "test"
location = azurerm_resource_group.resource-group.location
resource_group_name = azurerm_resource_group.resource-group.name
app_service_plan_id = azurerm_app_service_plan.service-plan.id
storage_account_name = azurerm_storage_account.storage-account.name
storage_account_access_key = azurerm_storage_account.storage-account.primary_access_key
app_settings = {
FUNCTION_APP_EDIT_MODE = "readOnly"
WEBSITE_RUN_FROM_PACKAGE = 1
FUNCTIONS_EXTENSION_VERSION = 2
FUNCTIONS_WORKER_RUNTIME = "java"
SCM_DO_BUILD_DURING_DEPLOYMENT = false
}
}
When deploying the above configuration only the Runtime is set to java, but since the version is not set, my deployments are not working.
The result in portal looks as follows: java stack settings
You could use version
argument to set the runtime version associated with the Function App. See Argument Reference.
Also, from the docs---How to target Azure Functions runtime versions
A function app runs on a specific version of the Azure Functions runtime. There are three major versions: 1.x, 2.x, and 3.x. By default, function apps are created in version 3.x of the runtime.
In this case, you could add argument version = "~3"
under the resource "azurerm_function_app" "function-app""
. It will get your expected result.