Terraform-provider-azurerm: Add Node.JS Language Support in azurerm_app_service

Created on 23 Aug 2019  路  4Comments  路  Source: terraform-providers/terraform-provider-azurerm

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

There doesn't seem to be a way of adding a NodeJS App Service as there is no mention of NodeJS on the terraform documentation.

This PR added an example by adding:

  site_config {
    linux_fx_version = "NODE|10.14"
  }

However, there is no mention of it on the documentation.

Furthermore, if I want to add Node 8.10 web app from the Azure portal the only option available to me is a Windows O/S so specifying linux_fx_version doesn't make any sense.

New or Affected Resource(s)

  • azurerm_app_service

References

bug servicapp-service

All 4 comments

FYI: If you use the Free/F1 SKU, the example fails with

Error: Error creating App Service "terraform-dev-app" (Resource Group "terraform-dev_rg"): web.AppsClient#CreateOrUpdate: Failure sending request: StatusCode=0 -- Original Error: autorest/azure: Service returned an error. Status=

It succeeds if you use the Standard/S1 sku in the example.

However, if you try to deploy a different version of nodejs it succeeds but with the wrong version of nodejs deployed:

  site_config {
    linux_fx_version = "NODE|8.10"
  }

SSH greets you with:

  _____
  /  _  \ __________ _________   ____
 /  /_\  \___   /  |  \_  __ \_/ __ \
/    |    \/    /|  |  /|  | \/\  ___/
\____|__  /_____ \____/ |__|    \___  >
        \/      \/                  \/
A P P   S E R V I C E   O N   L I N U X

Documentation: http://aka.ms/webapp-linux
NodeJS quickstart: https://aka.ms/node-qs
NodeJS Version : v10.14.2

root@fa46c997d6aa:/home/site/wwwroot#

It took me all day, but there is an unintuitive way of getting Node running as in the portal.

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"
  }
}

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"
  }
}

Note how the version is not the same as the supported version in the portal or the az cli.

Also note that when you export the template from the portal you see the node version as a property:

            "netFrameworkVersion": "v4.0",
            "phpVersion": "5.6",
            "pythonVersion": "",
            "nodeVersion": "8.10.0",
            "linuxFxVersion": "",

Which highlights even more the need to have node as an option in terraform.

Hi , I'm thinking of building Linux app service with Node Js , Does Terraform support this? Is this feature available now?

I had this issue too. This is an interesting thread. I could use some help testing a few scenarios as I develop this tutorial:
https://github.com/ourchitecture/patterns-and-tutorials/tree/main/src/tutorials/node/azure#readme

Windows vs. Linux. Standard vs. Free. Sounds like there could definitely be better docs directly from azurerm teams too.

Was this page helpful?
0 / 5 - 0 ratings