|
| 1 | +resource "azurerm_resource_group" "default" { |
| 2 | + name = "${var.name_prefix}-rg" |
| 3 | + location = var.location |
| 4 | +} |
| 5 | + |
| 6 | +resource "azurerm_storage_account" "default" { |
| 7 | + name = "${var.name_prefix}sa" |
| 8 | + resource_group_name = azurerm_resource_group.default.name |
| 9 | + location = azurerm_resource_group.default.location |
| 10 | + account_tier = "Standard" |
| 11 | + account_replication_type = "LRS" |
| 12 | + |
| 13 | + min_tls_version = "TLS1_2" |
| 14 | +} |
| 15 | + |
| 16 | +resource "azurerm_service_plan" "default" { |
| 17 | + name = "${var.name_prefix}-sap" |
| 18 | + location = azurerm_resource_group.default.location |
| 19 | + resource_group_name = azurerm_resource_group.default.name |
| 20 | + sku_name = "Y1" |
| 21 | + os_type = "Linux" |
| 22 | + |
| 23 | +} |
| 24 | +# please note: |
| 25 | +# 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. |
| 26 | +# 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. |
| 27 | +# 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 |
| 28 | +# in app_setting for you. |
| 29 | + |
| 30 | +resource "azurerm_linux_function_app" "test" { |
| 31 | + name = "${var.name_prefix}-lfa" |
| 32 | + location = azurerm_resource_group.default.location |
| 33 | + resource_group_name = azurerm_resource_group.default.name |
| 34 | + service_plan_id = azurerm_service_plan.default.id |
| 35 | + storage_account_name = azurerm_storage_account.default.name |
| 36 | + storage_account_access_key = azurerm_storage_account.default.primary_access_key |
| 37 | + https_only = true |
| 38 | + builtin_logging_enabled = false |
| 39 | + functions_extension_version = "~4" |
| 40 | + |
| 41 | + site_config { |
| 42 | + application_stack { |
| 43 | + dotnet_version = "6.0" |
| 44 | + } |
| 45 | + } |
| 46 | +} |
| 47 | + |
0 commit comments