Skip to content

Commit 34223ec

Browse files
authored
Merge pull request #91 from PerfectThymeTech/marvinbuss/fix_bugs
Add missing app configuration
2 parents 5a4bdca + 61dd1e4 commit 34223ec

File tree

3 files changed

+71
-52
lines changed

3 files changed

+71
-52
lines changed

code/infra/function.tf

Lines changed: 56 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -68,24 +68,24 @@ resource "azapi_resource" "function" {
6868
serverFarmId = azurerm_service_plan.service_plan.id
6969
storageAccountRequired = false
7070
vnetContentShareEnabled = true
71-
vnetImagePullEnabled = true
72-
virtualNetworkSubnetId = azapi_resource.subnet_function.id
71+
vnetImagePullEnabled = false # Set to 'true' when pulling image from private Azure Container Registry
7372
vnetRouteAllEnabled = true
73+
virtualNetworkSubnetId = azapi_resource.subnet_function.id
7474
siteConfig = {
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+
# autoHealEnabled = true # Enable to auto heal app based on configs
76+
# autoHealRules = {
77+
# actions = {
78+
# actionType = "LogEvent"
79+
# }
80+
# triggers = {
81+
# statusCodes = [
82+
# "429",
83+
# "504",
84+
# "507",
85+
# "508"
86+
# ]
87+
# }
88+
# }
8989
acrUseManagedIdentityCreds = false
9090
alwaysOn = true
9191
appSettings = [
@@ -105,26 +105,6 @@ resource "azapi_resource" "function" {
105105
name = "FUNCTIONS_EXTENSION_VERSION"
106106
value = "~4"
107107
},
108-
{
109-
name = "FUNCTIONS_WORKER_RUNTIME"
110-
value = "python"
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-
},
128108
{
129109
name = "WEBSITE_CONTENTOVERVNET"
130110
value = "1"
@@ -133,18 +113,6 @@ resource "azapi_resource" "function" {
133113
name = "WEBSITE_RUN_FROM_PACKAGE"
134114
value = "0"
135115
},
136-
{
137-
name = "PYTHON_ENABLE_WORKER_EXTENSIONS"
138-
value = "1"
139-
},
140-
{
141-
name = "ENABLE_ORYX_BUILD"
142-
value = "1"
143-
},
144-
{
145-
name = "SCM_DO_BUILD_DURING_DEPLOYMENT"
146-
value = "1"
147-
},
148116
{
149117
name = "AzureWebJobsStorage__accountName"
150118
value = azurerm_storage_account.storage.name
@@ -157,6 +125,46 @@ resource "azapi_resource" "function" {
157125
name = "AzureWebJobsSecretStorageKeyVaultUri"
158126
value = azurerm_key_vault.key_vault.vault_uri
159127
},
128+
{
129+
name = "WEBSITES_ENABLE_APP_SERVICE_STORAGE" # Disable when not running a container
130+
value = "false"
131+
},
132+
{
133+
name = "DOCKER_REGISTRY_SERVER_URL" # Disable when not running a container
134+
value = var.function_container_registry_url
135+
},
136+
# {
137+
# name = "FUNCTIONS_WORKER_RUNTIME" # Enable when running Python directly on the Function host
138+
# value = "python"
139+
# },
140+
# {
141+
# name = "FUNCTIONS_WORKER_SHARED_MEMORY_DATA_TRANSFER_ENABLED" # Enable when running Python directly on the Function host
142+
# value = "1"
143+
# },
144+
# {
145+
# name = "DOCKER_SHM_SIZE" # Enable when running Python directly on the Function host
146+
# value = "268435456"
147+
# },
148+
# {
149+
# name = "PYTHON_THREADPOOL_THREAD_COUNT" # Enable when running Python directly on the Function host
150+
# value = "None"
151+
# },
152+
# {
153+
# name = "PYTHON_ENABLE_DEBUG_LOGGING" # Enable when running Python directly on the Function host
154+
# value = "0"
155+
# },
156+
# {
157+
# name = "PYTHON_ENABLE_WORKER_EXTENSIONS" # Enable when running Python directly on the Function host
158+
# value = "1"
159+
# },
160+
# {
161+
# name = "ENABLE_ORYX_BUILD" # Enable when running Python directly on the Function host
162+
# value = "1"
163+
# },
164+
# {
165+
# name = "SCM_DO_BUILD_DURING_DEPLOYMENT" # Enable when running Python directly on the Function host
166+
# value = "1"
167+
# },
160168
{
161169
name = "MY_SECRET_CONFIG"
162170
value = "@Microsoft.KeyVault(SecretUri=${azurerm_key_vault_secret.key_vault_secret_sample.id})"

code/infra/variables.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,16 @@ variable "tags" {
3434
}
3535

3636
# Function variables
37+
variable "function_container_registry_url" {
38+
description = "Specifies the container image reference of the Azure Function."
39+
type = string
40+
sensitive = false
41+
validation {
42+
condition = startswith(var.function_container_registry_url, "https://")
43+
error_message = "Please specify a valid container image reference."
44+
}
45+
}
46+
3747
variable "function_container_image" {
3848
description = "Specifies the container image reference of the Azure Function."
3949
type = string

config/PerfectThymeTech/vars.tfvars

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ prefix = "myfunc"
55
tags = {}
66

77
# Function variables
8-
function_container_image = "ghcr.io/perfectthymetech/azurefunctionpython:main"
9-
function_sku = "P0v3"
10-
function_sku_cpus = 1
11-
function_health_path = "/v1/health/heartbeat"
8+
function_container_registry_url = "https://ghcr.io"
9+
function_container_image = "ghcr.io/perfectthymetech/azurefunctionpython:main"
10+
function_sku = "P0v3"
11+
function_sku_cpus = 1
12+
function_health_path = "/v1/health/heartbeat"
1213

1314
# Network variables
1415
vnet_id = "/subscriptions/8f171ff9-2b5b-4f0f-aed5-7fa360a1d094/resourceGroups/mycrp-prd-function-network-rg/providers/Microsoft.Network/virtualNetworks/mycrp-prd-function-vnet001"

0 commit comments

Comments
 (0)