azure - Terraform Azure Function App 部署 - 表示设置
问题描述
我正在尝试通过 Terraform 部署 Azure Function App
尝试表示函数应用设置时出现以下错误:
错误:azurerm_function_app.func-app-1::无效或未知键:always_on
错误:azurerm_function_app.func-app-1::无效或未知键:use_32_bit_worker_process
错误:azurerm_function_app.func-app-1::无效或未知键:websockets_enabled
以下是我正在使用的代码:
resource "azurerm_function_app" "func-app-1" {
name = "${var.func_app_1}"
location = "${data.azurerm_resource_group.core-rg.location}"
resource_group_name = "${data.azurerm_resource_group.core-rg.name}"
app_service_plan_id = "${data.azurerm_app_service_plan.app-service-plan-1.id}"
storage_connection_string = "${data.azurerm_storage_account.storage-account-1.primary_connection_string}"
version = "~1"
https_only = "true"
enabled = "true"
always_on = "true"
use_32_bit_worker_process = "false"
websockets_enabled = "true"
client_affinity_enabled = "false"
app_settings {
"FUNCTIONS_EXTENSION_VERSION" = "~1"
"KeyVaultURI" = “”
"WEBSITE_NODE_DEFAULT_VERSION" = "6.5.0"
}
}
任何帮助,将不胜感激
谢谢
解决方案
您需要在 variables.tf 中定义应用程序设置
resource "azurerm_function_app" "func-app-1" {
name = "${var.func_app_1}"
location = "${data.azurerm_resource_group.core-rg.location}"
resource_group_name = "${data.azurerm_resource_group.core-rg.name}"
app_service_plan_id = "${data.azurerm_app_service_plan.app-service-plan-1.id}"
storage_connection_string = "${data.azurerm_storage_account.storage-account-1.primary_connection_string}"
version = "~1"
https_only = "true"
enabled = "true"
always_on = "true"
use_32_bit_worker_process = "false"
websockets_enabled = "true"
client_affinity_enabled = "false"
app_settings = "${var.app_settings}"
}
在变量.tf
variable "app_settings" {
description = "A key-value pair of App Settings"
default = {
"FUNCTIONS_EXTENSION_VERSION" = "~1",
"KeyVaultURI" = “”,
"WEBSITE_NODE_DEFAULT_VERSION" = "6.5.0"
}
}
推荐阅读
- smtp - Jira 不使用 SMTP 密码
- python - 为什么我在 python subplot 中的绘图大小不同?
- python-3.x - 如何知道页面是否离线或没有响应?
- javascript - 检查对方是否重定向到登录页面
- python - 使用 Django 进行电子邮件编码
- java - 由 JsonItemReaderBuilder 构建的单元测试阅读器
- ios - Firebase 通知 iOS 在本机反应
- python - 如何使用 conda 更新到最新的 Python 版本?
- javascript - 使用带有 JavaScript 的量角器单击日历中的日期
- sql - 用于在 aws athena (presto) 中创建数组映射的 sql 查询