'Terraform not accepting block parameters on "web_app" Module
I am trying to create a web app through Terraform, the new azurerm provider 3.0 has come out and so the new module azurerm_windows_web_app. The documentation states that the block application_stack supports the following: current_stack, docker, Java, etc.
azurerm version = "=3.0.0"
Link to documentation of Terraform: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/windows_web_app#example-usage
Once I try to run the module created for this, it throws an error:
Error: Unsupported block type
Blocks of type "application_stack" are not expected here.

Here is a snippet of my code, I am not sure what is going on. Tried to google it but it seems to new to have documentation from other users. Any insight?
resource "azurerm_windows_web_app" "web_app_resource" {
name = var.resource_name
resource_group_name = var.resource_group_name
location = var.location
service_plan_id = var.app_service_plan_id
https_only = true
tags = var.tags
count = var.create
site_config {}
application_stack {
current_stack = var.current_stack
dotnet_version = var.dotnet_version
}
}
Solution 1:[1]
If we check the resource schema for the windows_web_app resource at version 3.0.2 of the provider, then we see that it is currently missing a definition for the application_stack attribute. It also seems to be missing other blocks specified in the documentation.
You need to file an issue for your error as this is a bug in the provider.
Update: As this answer is now the victim of sock puppets revisiting, it should be noted application_stack is now a nested block in the site_config block from its schema. Deleting the answer once un-accepted to avoid further issues.
Solution 2:[2]
Block application_stack must be nested under site_config. JKirk comment is correct.
resource "azurerm_linux_web_app" "default" {
name = var.resource_name
resource_group_name = var.resource_group_name
location = var.location
service_plan_id = var.app_service_plan_id
site_config {
# Correct placement
application_stack {
python_version = 3.9
}
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 |
