hashicorp / terraform-provider-azurerm

Terraform provider for Azure Resource Manager
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs
Mozilla Public License 2.0
4.53k stars 4.6k forks source link

Unexpected behavior when deploying to azurerm_windows_web_app to Linux service_plan #25606

Open khaake261 opened 5 months ago

khaake261 commented 5 months ago

Is there an existing issue for this?

Community Note

Terraform Version

1.5.2

AzureRM Provider Version

3.87.0

Affected Resource(s)/Data Source(s)

azurerm_windows_web_app

Terraform Configuration Files

resource "azurerm_service_plan" "example" {
  name                       = "example"
  resource_group_name        = azurerm_resource_group.example.name
  location                   = azurerm_resource_group.example.location
  os_type                    = "Linux"
  sku_name                   = "I1v2"
  app_service_environment_id = azurerm_app_service_environment.example.id
  zone_balancing_enabled     = false
}

resource "azurerm_windows_web_app" "example" {
  name                = "example"
  resource_group_name = azurerm_resource_group.example.name
  location            = azurerm_service_plan.example.location
  service_plan_id     = azurerm_service_plan.example.id

  site_config {}
}

Debug Output/Panic Output

--

Expected Behaviour

An error was expected when trying to deploy a Windows web app to a Linux service plan.

Actual Behaviour

Successful plan and apply, except a Linux web app was deployed instead of a Windows web app.

Steps to Reproduce

terraform apply

Important Factoids

No response

References

No response

xiaxyi commented 5 months ago

Thanks @khaake261 for raising this issue, currently, we don't validate the service plan type when attaching an app to it. May I know why did you try to attach a windows web app to a linux service plan?

khaake261 commented 5 months ago

@xiaxyi It was deployed to a Linux service plan by accident when doing some unrelated testing, but I thought the resulting behavior was unexpected. Is there a reason for not having validation on the service plan type when attaching an app?