Open kpggt opened 11 months ago
Thanks @kpggt for raising this issue, Terraform sets the dotnet application stack (dotnet_core/ dotnet) based on the site's meta.
Can you help me to confirm whether your dotnet app is at dotnet core stack using the api:
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/metadata/list?api-version=2022-03-01?
https://learn.microsoft.com/en-us/rest/api/appservice/web-apps/list-metadata?view=rest-appservice-2022-03-01
im very sorry for not replying to this sooner, we added an ignore and have pushed this change to production. So im working on finding a suitable lab environment to retest this on, but due to the upcoming holiday, my reply will be after newyear.
Hi @xiaxyi, I am running into this issue as well, but adding to ignore_changes doesn't work for me. Can you provide further information on how to gather potential metadata for an app service to troubleshoot further? I am getting the following error:
curl -X GET "https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/metadata/list?api-version=2022-03-01?"
{"error":{"code":"MissingApiVersionParameter","message":"The api-version query parameter (?api-version=) is required for all requests."}}
Thanks in advance for your assistance.
After doing some local testing on this, the issue occurs if the Web App is configured in the back-end to be a .Net Core app, instead of just a .Net app. I'm assuming this is a legacy hangover from when the platform had a difference between Core and Windows .NET applications.
To solve the problem, add the current_stack
property to the application_stack
property, and set it to dotnet
. This should solve the perpetual change.
resource "azurerm_windows_web_app" "this" {
name = "windows-web-app-432as"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
service_plan_id = azurerm_service_plan.windows.id
site_config {
application_stack {
current_stack = "dotnet"
dotnet_version = "v8.0"
}
}
}
I'll have a look at what we might be able to do in the provider - it seems to just be a cosmetic legacy hangover...
Is there an existing issue for this?
Community Note
Terraform Version
1.5.0
AzureRM Provider Version
3.84.0
Affected Resource(s)/Data Source(s)
azurerm_windows_web_app
Terraform Configuration Files
Debug Output/Panic Output
Expected Behaviour
on subsequent runs i dont want to be told the dotnet_core_version will be set to null _version needs to be changes from what ever value dotnet_version was
Actual Behaviour
on subsequent runs im told the dotnet_core_version will be set to null _version needs to be changes from whatever value dotnet_version was
Steps to Reproduce
No response
Important Factoids
No response
References
No response