Node.js 22 & 24 LTS Support For Azure Linux Web App

by Alex Johnson 52 views

This article discusses the necessity of incorporating Node.js 22 LTS and 24 LTS support into the azurerm_linux_web_app resource within the Terraform AzureRM provider. Currently, while Azure App Service supports these newer Node.js versions for Linux web apps, the Terraform provider does not recognize them, leading to configuration errors. This limitation hinders users from leveraging the latest Node.js features and security updates in their Azure deployments managed by Terraform. Addressing this issue is crucial for maintaining parity between Azure services and the Terraform provider, ensuring a seamless and up-to-date experience for users.

The Issue: Unsupported Node.js Versions

The core problem lies in the azurerm_linux_web_app resource's inability to accept node_version values of "22-lts" and "24-lts". When users attempt to specify these versions in their Terraform configurations, they encounter an error message indicating that only "12-lts", "14-lts", "16-lts", "18-lts", and "20-lts" are valid options. This discrepancy between Azure's support for Node.js 22 LTS and 24 LTS and the Terraform provider's limitations creates a significant obstacle for developers seeking to utilize these versions.

Error: expected site_config.0.application_stack.0.node_version to be one of ["12-lts" "14-lts" "16-lts" "18-lts" "20-lts"], got 22-lts

This error message clearly illustrates the issue: the Terraform provider's schema for the node_version attribute does not include the newer LTS versions. Consequently, Terraform rejects any configuration that attempts to use Node.js 22 or 24, even though these versions are officially supported by Azure App Service.

Verifying Azure's Support

To confirm that Azure App Service indeed supports Node.js 22 LTS and 24 LTS, users can employ the Azure CLI. The following command retrieves a list of available runtimes for Linux web apps, filtering the results to show only Node.js versions:

az webapp list-runtimes --os linux | grep -i node

The output of this command will include Node.js 22 and 24, demonstrating that Azure's platform supports these runtimes. Furthermore, Microsoft has officially announced the availability of Node.js 24 on Azure App Service, as highlighted in their blog post: https://azure.github.io/AppService/2025/10/29/node24-available.html. This announcement serves as further confirmation that the lack of support in the Terraform provider is a discrepancy that needs addressing.

Impact and Use Cases

The absence of Node.js 22 and 24 LTS support in the azurerm_linux_web_app resource has several implications for Terraform users deploying applications to Azure. Firstly, it prevents them from taking advantage of the performance improvements, new features, and security enhancements offered by these newer Node.js versions. Secondly, it introduces a potential maintenance burden, as users may be forced to stick with older, less secure Node.js versions to maintain compatibility with their Terraform infrastructure code. Thirdly, it creates inconsistencies between the infrastructure-as-code managed by Terraform and the actual runtime environment on Azure, potentially leading to configuration drift and unexpected behavior.

Consider the following scenarios where support for Node.js 22 and 24 LTS is crucial:

  • New application deployments: Developers starting new projects may want to leverage the latest Node.js features and improvements from the outset. The lack of support in Terraform forces them to either use older Node.js versions or resort to manual configuration outside of Terraform, which defeats the purpose of infrastructure-as-code.
  • Application upgrades: Existing applications running on older Node.js versions may need to be upgraded to benefit from security patches, performance enhancements, and new language features. Without Terraform support, these upgrades become more complex and error-prone.
  • Compliance requirements: Some organizations have strict compliance requirements that mandate the use of the latest LTS versions of software. The inability to specify Node.js 22 or 24 in Terraform configurations can hinder compliance efforts.

In each of these cases, the lack of support for Node.js 22 and 24 LTS in the azurerm_linux_web_app resource presents a significant challenge, limiting the flexibility and effectiveness of Terraform as an infrastructure-as-code tool.

Proposed Solution and Configuration Example

The solution to this issue is straightforward: the Terraform AzureRM provider needs to be updated to include "22-lts" and "24-lts" as valid options for the node_version attribute within the site_config.application_stack block of the azurerm_linux_web_app resource. This update would align the provider with Azure's capabilities and allow users to seamlessly manage their Node.js runtime versions using Terraform.

Here's an example of how a Terraform configuration would look once the update is implemented:

resource "azurerm_linux_web_app" "example" {
  name                = "example-web-app"
  resource_group_name = azurerm_resource_group.example.name
  location            = azurerm_resource_group.example.location
  service_plan_id     = azurerm_service_plan.example.id

  site_config {
    application_stack {
      node_version = "24-lts"  # Now a valid option
    }
  }
}

In this configuration, the node_version attribute is set to "24-lts", which would be a valid value after the provider is updated. This allows users to specify the desired Node.js runtime version directly within their Terraform code, ensuring that their web app is deployed with the correct environment.

Affected Resources

The impact of this issue extends beyond the azurerm_linux_web_app resource. The azurerm_linux_web_app_slot resource, which is used to manage deployment slots for Linux web apps, is also affected. This is because the azurerm_linux_web_app_slot resource shares the same underlying schema for site_config.application_stack as the azurerm_linux_web_app resource. Therefore, any fix for this issue must also include updates to the azurerm_linux_web_app_slot resource to ensure consistency and complete support for Node.js 22 and 24 LTS.

Community Involvement and Prior Efforts

This issue has been raised in the Terraform AzureRM provider community before, indicating that it is a recognized pain point for users. There are related past issues that highlight the need for Node.js version updates, such as #24287 (which requested support for 20-lts) and #28829 (which specifically requested support for 22-lts). These previous discussions underscore the importance of addressing this issue and the potential benefits it would bring to the Terraform community.

The community's engagement with this issue is crucial for prioritizing its resolution. Users are encouraged to vote on this issue by adding a 👍 reaction to the original issue on the Terraform provider's GitHub repository. This helps the maintainers gauge the demand for this feature and allocate resources accordingly. It is also important to avoid leaving "+1" or "me too" comments, as these can generate unnecessary noise for issue followers. Instead, users who are interested in contributing to the solution or have relevant information to share are encouraged to leave detailed comments explaining their use cases or suggesting potential approaches.

Conclusion

In conclusion, the lack of support for Node.js 22 LTS and 24 LTS in the azurerm_linux_web_app and azurerm_linux_web_app_slot resources within the Terraform AzureRM provider is a significant limitation. It prevents users from leveraging the latest Node.js features, security updates, and performance improvements in their Azure deployments managed by Terraform. Addressing this issue by updating the provider's schema to include these newer Node.js versions is crucial for maintaining parity between Azure services and Terraform, ensuring a seamless and up-to-date experience for users. The proposed solution involves modifying the node_version attribute within the site_config.application_stack block to accept "22-lts" and "24-lts" as valid options. This update would enable users to specify the desired Node.js runtime version directly within their Terraform code, aligning their infrastructure-as-code with the actual runtime environment on Azure. By resolving this issue, the Terraform AzureRM provider can better serve the needs of its users and facilitate the adoption of the latest Node.js technologies on Azure.

For more information on Azure App Service and supported Node.js versions, please visit the official Microsoft Azure documentation: https://learn.microsoft.com/en-us/azure/app-service/configure-language-nodejs.