Adding guidance for function app (#116)

* adding guidance for function app
This commit is contained in:
Xiaxin
2022-11-16 13:56:21 +08:00
committed by GitHub
parent 329bfd1f6e
commit e32966e242
6 changed files with 193 additions and 0 deletions

View File

@ -0,0 +1,47 @@
resource "azurerm_resource_group" "default" {
name = "${var.name_prefix}-rg"
location = var.location
}
resource "azurerm_storage_account" "default" {
name = "${var.name_prefix}sa"
resource_group_name = azurerm_resource_group.default.name
location = azurerm_resource_group.default.location
account_tier = "Standard"
account_replication_type = "LRS"
min_tls_version = "TLS1_2"
}
resource "azurerm_service_plan" "default" {
name = "${var.name_prefix}-sap"
location = azurerm_resource_group.default.location
resource_group_name = azurerm_resource_group.default.name
sku_name = "Y1"
os_type = "Linux"
}
# please note:
# You may see custom (~4) is set to the app's runtime version, along with a warning says “Your app is pinned to an unsupported runtime version for dotnet. For better performance, we recommend using one of our supported versions instead: xxx.”. This is because azure function v4 runtime requires .NET6.0 but the default value is 4.0. You need to set the .netframeworkversion to v6.0 to support azure funtion v4.
# If you would like to set the function runtime version, please use functions_extension_version property, terraform will set the FUNCTIONS_EXTENSION_VERSION in app_setting block, you don't need to specify the key in app_setting block.
# If you would like to set the required number of failed requests for an instance to be deemed unhealthy and removed from the load balancer under health check feature, using health_check_eviction_time_in_min property under site_config block. Terraform will set the key WEBSITE_HEALTHCHECK_MAXPINGFAILURES
# in app_setting for you.
resource "azurerm_linux_function_app" "test" {
name = "${var.name_prefix}-lfa"
location = azurerm_resource_group.default.location
resource_group_name = azurerm_resource_group.default.name
service_plan_id = azurerm_service_plan.default.id
storage_account_name = azurerm_storage_account.default.name
storage_account_access_key = azurerm_storage_account.default.primary_access_key
https_only = true
builtin_logging_enabled = false
functions_extension_version = "~4"
site_config {
application_stack {
dotnet_version = "6.0"
}
}
}