I have created an Azure Web App using terraform but it has the wrong version of NodeJS in it.
resource "azurerm_app_service_plan" "app-plan" {
name = "${var.prefix}-app-plan"
resource_group_name = var.resource_group_name
location = var.resource_group_location
sku {
tier = "Free"
size = "F1"
}
}
#azurerm_app_service doesn't support creating Node.JS 8.10 apps
#https://github.com/terraform-providers/terraform-provider-azurerm/issues/4144
resource "azurerm_app_service" "app-service" {
name = "${var.prefix}-app"
resource_group_name = var.resource_group_name
location = var.resource_group_location
app_service_plan_id = azurerm_app_service_plan.app-plan.id
}
I have tried updating the configuration using the rest api
{
"properties": {
"nodeVersion": "8.10"
}
}
and also updating the application settings using the rest api
{
"properties": {
"WEBSITE_NODE_DEFAULT_VERSION": "8.10"
}
}
However, when I run the Console it still says node --version v0.10.40
When I run env
it looks like the PATH
variable is incorrect.
Node 8.10 does exist on the machine at D:\Program Files (x86)\nodejs\8.10.0
How can I update the path from the rest api?
Are there any alternatives?
My preferences are terraform > az cl > rest api
Note: Bear in mind that when I create the web app in the portal, selecting Node 8.10 forces me to choose Windows as the O/S.
In the portal it specifies Node 8.10
as a Runtime stack.
The az cli specifies 8.10
as a runtime:
az webapp list-runtimes|grep "8.10"
"node|8.10",
However, as you can see in the question, the version installed is 8.10.0
.
If we set this in the application settings with terraform this (unintuitively) sets the correct node version:
resource "azurerm_app_service" "app-service" {
name = "${var.prefix}-app"
resource_group_name = var.resource_group_name
location = var.resource_group_location
app_service_plan_id = azurerm_app_service_plan.app-plan.id
app_settings = {
#The portal and az cli list "8.10" as the supported version.
#"8.10" doesn't work here!
#"8.10.0" is the version installed in D:\Program Files (x86)\nodejs
"WEBSITE_NODE_DEFAULT_VERSION" = "8.10.0"
}
}