terraform-provider-azurerm: azurerm_windows_function_app dotnet version not set correctly
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
Terraform Version
1.1.8
AzureRM Provider Version
3.2.0
Affected Resource(s)/Data Source(s)
azurerm_windows_function_app
Terraform Configuration Files
resource "azurerm_windows_function_app" "fun-app" {
name = "${local.name_slug}functionapp"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
service_plan_id = data.azurerm_service_plan.asp.id
storage_account_name = azurerm_storage_account.sa.name
storage_account_access_key = azurerm_storage_account.sa.primary_access_key
functions_extension_version = "~4"
site_config {
always_on = true
scm_use_main_ip_restriction = "false"
worker_count = 2
application_stack {
dotnet_version = "6"
}
}
}
Debug Output/Panic Output
Deploys without issue
Expected Behaviour
The expected behavior is to deploy a windows function app with function runtime ~4.
Actual Behaviour
The actual result of deployment is runtime version “custom” and the only supported drop down is ~3. I’m assuming the reason for “custom” is the function app was created with dotnet version 3.1 and does not support runtime ~4 only ~3, however I specified dotnet 6 in TF. When I create manually in azure portal the function app is created with the correct dotnet 6. I can even import the manually created function app to the same resource in terraform state with no issues.
Steps to Reproduce
Just try to create a function app using the new azurerm_windows_function_app with dotnet 6 and runtime ~4.
I’m assuming the configuration for dotnet 6 is under application stack and runtime version is under functions_extension_version.
functions_extension_version = “~4” application_stack { dotnet_version = “6”
I tried both options 3.1 and 6 (as documented) both yield the same result.
Important Factoids
no
References
no
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 42
- Comments: 24 (4 by maintainers)
Likewise, I have the same issue.
Upon further investigation, I have found in the azure resource browser: https://resources.azure.com/
The configuration
configdocument has the following values when created using theazurerm_windows_function_appterraform resource:Upon creating the resource manually via the azure ui/portal:
NOTE: the
netFrameworkVersionandwindowsFxVersionare different. I think that the later should be the correct values for this not the ones that are being created at present.Upon manually updating the attributes via the eddittor the
~4function version was available in the drop down.UPDATE: Further to this my workaround has been to run:
This setep is run within my automation during the software deployment phase as I use PowerShell to deploy the functions contents, therefore, this is the most logical I’m my instance.
I’m using AzAPI provider to resolve any of these types of issues.
New deploy reference:
Update existing example:
There are numerous issues with this resource type over the old one - it also won’t generate host keys either. https://github.com/hashicorp/terraform-provider-azurerm/issues/17750
I’ve switched back to the old resource azurerm_function_app - these new ones just don’t work. The fact that this issue was raised in April and its now nearly August proves my point. I’ve no idea why these where introduced in this state.
Guide/info here also.
Thanks guys for raising the issue. For the newly created windows functions, we will set the .NetFrameworkVersion to v6.0 if dotnet_version sets to 6 in the TF config, it should fix the issue custom ~4. As mentioned in our docs, function runtime 4.0 requires the underlying .Net version6, if the functions are created before, please aslo set the .net version to 6 when upgrading the function worker runtime to 4 and it should resolve custom ~4 situation.
I am experiencing the same problem with the azurerm_linux_function_app. Any updates on the triage?