terraform-provider-azurerm: BUG: windows app service with container is not getting created as expected
Is there an existing issue for this?
- I have searched the existing issues
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
Azure windows app service with docker container is not getting created properly.
Expected: when we create terraform resource āazurerm_windows_web_appā with āapplication_stackā block having values such as docker_container_name, docker_container_tag, docker_container_registry. It should create app service with container, having an image as specified in application_stackā block.
But instead of creating app service with container features, it creates plane app service. Note- Creation happens properly in case of linux app service with container (azurerm_linux_web_app)
Here is the code which is taken from: windows-container
main.tf:
provider "azurerm" {
features {}
}
resource "azurerm_resource_group" "example" {
name = "${var.prefix}-resources"
location = var.location
}
resource "azurerm_service_plan" "example" {
name = "${var.prefix}-sp"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
os_type = "Windows"
sku_name = "P1v3"
}
resource "azurerm_windows_web_app" "example" {
name = "${var.prefix}-container-example"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
service_plan_id = azurerm_service_plan.example.id
app_settings = {
"WEBSITES_ENABLE_APP_SERVICE_STORAGE" = "false"
}
site_config {
application_stack {
docker_container_name = "jackofallops/azure-containerapps-python-acctest"
docker_container_tag = "v0.0.1"
}
}
}
variables.tf:
variable "prefix" {
type = string
description = "The prefix used for all resources in this example"
default = "mywebwincontainrc93"
}
variable "location" {
type = string
description = "The Azure location where all resources in this example should be created"
default = "West Europe"
}
Root Cause: While analyzing the different aspects of this issue, I exported the json template from azure portal, compared linux & windows json template and came to know that property: Kind is not getting set properly in case of windows app service hence the issue. In this case property: Kind is getting set as: ākindā: āappā while it should be: ākindā: āapp,windows,containerā While its getting set properly in case of linux app service with container i.e. ākindā: āapp,linux,containerā,
Refer imageā> linux app service with container:

imageā> windows app service with container, which is wrong:

Also it can be seen while destroying the resources too:

This issue blocks users to create an azure windows app service with container using terraform, which pulls image from specific container source, either docker or acr.
Terraform Version
1.1.6
AzureRM Provider Version
3.10.0
Affected Resource(s)/Data Source(s)
azurerm_windows_web_app
Terraform Configuration Files
resource "azurerm_windows_web_app" "example" {
name = "${var.prefix}-container-example"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
service_plan_id = azurerm_service_plan.example.id
app_settings = {
"WEBSITES_ENABLE_APP_SERVICE_STORAGE" = "false"
}
site_config {
application_stack {
docker_container_name = "jackofallops/azure-containerapps-python-acctest"
docker_container_tag = "v0.0.1"
}
}
}
Debug Output/Panic Output
provided in screenshot
Expected Behaviour
should create azure windows app service container
Actual Behaviour
creating normal azure windows app service
Steps to Reproduce
- Clone code from : windows-container
- terraform init
- terraform plan
- terraform apply
- Once resources are created successfully, go to the app service from azure portal. In app service, select option āDeployment Centerā from the left side options menu
- It must show container details along with image details & tag. But its not doing so.
Important Factoids
No response
References
No response
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 2
- Comments: 22 (8 by maintainers)
Thanks @rohit93c let me try from my side