Is it a known issue that Terraform failed to create a custom app (locally built Rust app) using Elastic Premium Plan? Or, I missed some configuration?
The function was successfully deployed to Consumption plan but failed with Elastic Premium plan. According to article Automate function app resource deployment to Azure | Microsoft Docs, ‘WEBSITE_CONTENTAZUREFILECONNECTIONSTRING’ was added to the app settings, but failed with following error. Why did this happen when the document suggests that ‘WEBSITE_CONTENTSHARE’ should not be set? If I use Azure Portal, the function was successfully created using Elastic Premium plan and both WEBSITE_* parameters were created correctly.
Error: Error updating Application Settings for Function App “lethalpenguintestdev-flatpakingest”: web.AppsClient#UpdateApplicationSettings: Failure responding to request: StatusCode=400 – Original Error: autorest/azure: Service returned an error. Status=400 Code=“BadRequest” Message=“Required parameter WEBSITE_CONTENTSHARE is missing.” Details=[{“Message”:“Required parameter WEBSITE_CONTENTSHARE is missing.”},{“Code”:“BadRequest”},{“ErrorEntity”:{“Code”:“BadRequest”,“ExtendedCode”:“01010”,“Message”:“Required parameter WEBSITE_CONTENTSHARE is missing.”,“MessageTemplate”:“Required parameter {0} is missing.”,“Parameters”:[“WEBSITE_CONTENTSHARE”]}}]
Variables set -
size: “EP1”
tier: “ElasticPremium”
plan_location: “centralus”
fo_location: “centralus”
Sample code -
module “azfoing” {
source = “…/…/apps/azfo”
name = “${var.name}-flatpakingest”
resource_group = var.resource_group
storage_account = module.storage.sa
app_settings = {
APPINSIGHTS_INSTRUMENTATIONKEY = var.ai_key
FlatPakStorageAccount = module.storage.sa.primary_connection_string
WEBSITE_CONTENTAZUREFILECONNECTIONSTRING = module.storage.sa.primary_connection_string
}
source_stamp = var.flatpakingest_source_stamp
logworkspace_id = var.logworkspace_id
}
resource “azurerm_function_app” “app” {
name = var.name
location = var.resource_group.location
location = var.source_stamp.fo_location
resource_group_name = var.resource_group.name
app_service_plan_id = azurerm_app_service_plan.asp.id
storage_account_name = var.storage_account.name
storage_account_access_key = var.storage_account.primary_access_key
os_type = “linux”
version = “~3”
enabled = var.source_stamp.enabled
app_settings = merge(
{
FUNCTIONS_WORKER_RUNTIME = var.source_stamp.runtime
FUNCTIONS_WORKER_PROCESS_COUNT = var.source_stamp.process_count
},
var.app_settings
)
site_config {
always_on = (var.source_stamp.tier == “Standard” || var.source_stamp.tier == “PremiumV2”) ? true : false
use_32_bit_worker_process = false
}
lifecycle {
ignore_changes = [
app_settings[“WEBSITE_RUN_FROM_PACKAGE”]
]
}
}