@@ -7,7 +7,7 @@ resource "azurerm_service_plan" "service_plan" {
7
7
# maximum_elastic_worker_count = 20
8
8
os_type = " Linux"
9
9
per_site_scaling_enabled = false
10
- sku_name = " P1v3 "
10
+ sku_name = var . function_sku
11
11
worker_count = 1 # Update to '3' for production
12
12
zone_balancing_enabled = false # Update to 'true' for production
13
13
}
@@ -50,7 +50,7 @@ resource "azapi_resource" "function" {
50
50
}
51
51
52
52
body = jsonencode ({
53
- kind = " functionapp,linux"
53
+ kind = " functionapp,linux,container "
54
54
properties = {
55
55
clientAffinityEnabled = false
56
56
clientCertEnabled = false
@@ -64,14 +64,28 @@ resource "azapi_resource" "function" {
64
64
publicNetworkAccess = " Disabled"
65
65
redundancyMode = " None"
66
66
reserved = true
67
- scmSiteAlsoStopped = false
67
+ scmSiteAlsoStopped = true
68
68
serverFarmId = azurerm_service_plan.service_plan.id
69
69
storageAccountRequired = false
70
70
vnetContentShareEnabled = true
71
+ vnetImagePullEnabled = true
71
72
virtualNetworkSubnetId = azapi_resource.subnet_function.id
72
73
vnetRouteAllEnabled = true
73
74
siteConfig = {
74
- autoHealEnabled = false
75
+ autoHealEnabled = true
76
+ autoHealRules = {
77
+ actions = {
78
+ actionType = " LogEvent"
79
+ }
80
+ triggers = {
81
+ statusCodes = [
82
+ " 429" ,
83
+ " 504" ,
84
+ " 507" ,
85
+ " 508"
86
+ ]
87
+ }
88
+ }
75
89
acrUseManagedIdentityCreds = false
76
90
alwaysOn = true
77
91
appSettings = [
@@ -80,8 +94,12 @@ resource "azapi_resource" "function" {
80
94
value = azurerm_application_insights.application_insights.connection_string
81
95
},
82
96
{
83
- name = " APPINSIGHTS_INSTRUMENTATIONKEY"
84
- value = azurerm_application_insights.application_insights.instrumentation_key
97
+ name = " AZURE_FUNCTIONS_ENVIRONMENT"
98
+ value = " Production"
99
+ },
100
+ {
101
+ name = " FUNCTIONS_WORKER_PROCESS_COUNT"
102
+ value = " ${ var . function_sku_cpus } "
85
103
},
86
104
{
87
105
name = " FUNCTIONS_EXTENSION_VERSION"
@@ -91,6 +109,22 @@ resource "azapi_resource" "function" {
91
109
name = " FUNCTIONS_WORKER_RUNTIME"
92
110
value = " python"
93
111
},
112
+ {
113
+ name = " FUNCTIONS_WORKER_SHARED_MEMORY_DATA_TRANSFER_ENABLED"
114
+ value = " 1"
115
+ },
116
+ {
117
+ name = " DOCKER_SHM_SIZE"
118
+ value = " 268435456"
119
+ },
120
+ {
121
+ name = " PYTHON_THREADPOOL_THREAD_COUNT"
122
+ value = " None"
123
+ },
124
+ {
125
+ name = " PYTHON_ENABLE_DEBUG_LOGGING"
126
+ value = " 0"
127
+ },
94
128
{
95
129
name = " WEBSITE_CONTENTOVERVNET"
96
130
value = " 1"
@@ -115,6 +149,14 @@ resource "azapi_resource" "function" {
115
149
name = " AzureWebJobsStorage__accountName"
116
150
value = azurerm_storage_account.storage.name
117
151
},
152
+ {
153
+ name = " AzureWebJobsSecretStorageType"
154
+ value = " keyvault"
155
+ },
156
+ {
157
+ name = " AzureWebJobsSecretStorageKeyVaultUri"
158
+ value = azurerm_key_vault.key_vault.vault_uri
159
+ },
118
160
{
119
161
name = " MY_SECRET_CONFIG"
120
162
value = " @Microsoft.KeyVault(SecretUri=${ azurerm_key_vault_secret . key_vault_secret_sample . id } )"
@@ -126,15 +168,18 @@ resource "azapi_resource" "function" {
126
168
functionsRuntimeScaleMonitoringEnabled = false
127
169
ftpsState = " Disabled"
128
170
healthCheckPath = var.function_health_path
129
- http20Enabled = false
171
+ http20Enabled = true
130
172
ipSecurityRestrictionsDefaultAction = " Deny"
131
- linuxFxVersion = " Python |${ var . function_python_version } "
173
+ linuxFxVersion = " DOCKER |${ var . function_container_image } "
132
174
localMySqlEnabled = false
133
175
loadBalancing = " LeastRequests"
134
176
minTlsVersion = " 1.2"
177
+ minTlsCipherSuite = " TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256"
135
178
minimumElasticInstanceCount = 0
136
179
numberOfWorkers = 1
137
180
preWarmedInstanceCount = 0
181
+ remoteDebuggingEnabled = false
182
+ requestTracingEnabled = true
138
183
scmMinTlsVersion = " 1.2"
139
184
scmIpSecurityRestrictionsUseMain = false
140
185
scmIpSecurityRestrictionsDefaultAction = " Deny"
@@ -144,6 +189,18 @@ resource "azapi_resource" "function" {
144
189
}
145
190
}
146
191
})
192
+
193
+ schema_validation_enabled = false
194
+ # ignore_body_changes = [
195
+ # "properties.siteConfig.appSettings"
196
+ # ]
197
+ depends_on = [
198
+ azurerm_private_endpoint . key_vault_private_endpoint ,
199
+ azurerm_private_endpoint . storage_private_endpoint_blob ,
200
+ azurerm_private_endpoint . storage_private_endpoint_file ,
201
+ azurerm_private_endpoint . storage_private_endpoint_queue ,
202
+ azurerm_private_endpoint . storage_private_endpoint_table ,
203
+ ]
147
204
}
148
205
149
206
data "azurerm_monitor_diagnostic_categories" "diagnostic_categories_function" {
0 commit comments