You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Terraform部署Azure Linux Function App时application_stack配置报错求助

问题解决:Azure Linux Function App Terraform配置中application_stack的错误

你的错误核心是把application_stack当成了键值对参数来赋值,但在azurerm_linux_function_app的site_config下,它是一个嵌套块,不能用=和大括号的写法,必须改成块的语法。

修正后的完整配置如下:

resource "azurerm_linux_function_app" "function_app" {
  depends_on                 = [azurerm_storage_account.example, azurerm_service_plan.app_service_plan]
  name                       = "example-linux-function-app-6375367"
  resource_group_name        = var.resource-group-name
  location                   = var.location
  service_plan_id            = azurerm_service_plan.app_service_plan.id
  storage_account_name       = azurerm_storage_account.example.name
  storage_account_access_key = azurerm_storage_account.example.primary_access_key
  app_settings = {
    "WEBSITE_RUN_FROM_PACKAGE" = 1,
    "AzureWebJobsStorage" = azurerm_storage_account.example.primary_connection_string
  }
  site_config {
    # 改为嵌套块写法,移除=号
    application_stack {
      python_version = "3.10"
    }
  }
}

同时请确认你的AzureRM Provider为最新版本,这个嵌套块结构是对应新版Provider的定义,和官方文档描述一致。

内容的提问来源于stack exchange,提问作者Indrid

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.26 22:27:10