Terraform Azure Function应用程序部署-表示设置

时间:2018-09-04 17:47:05

标签: azure terraform

我正在尝试通过Terraform部署Azure Function应用

尝试表示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 _

以下是我正在使用的代码:

            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"

            }

            }

任何帮助将不胜感激

谢谢

3 个答案:

答案 0 :(得分:1)

我相信您需要根据以下文档在site_config块中添加错误的值:https://www.terraform.io/docs/providers/azurerm/d/app_service.html

答案 1 :(得分:1)

您需要在variables.tf中定义应用程序设置

config = tf.estimator.RunConfig(model_dir='./NEW_PATH/', ) # new path
model_estimator = tf.estimator.Estimator(model_fn=model_fn, config=config)

在variables.tf中

model_dir

答案 2 :(得分:0)

请在site_config下定义相同的内容。请参考下面的代码。您可以进一步添加

resource "azurerm_function_app" "prod" {
  name                      = "${var.function_app_name}"
  location                  = "${azurerm_resource_group.prod.location}"
  resource_group_name       = "${azurerm_resource_group.prod.name}"
  app_service_plan_id       = "${azurerm_app_service_plan.prod.id}"
  storage_connection_string = "${azurerm_storage_account.prod.primary_connection_string}"
  version                   = "~2"
  app_settings = {
    APPINSIGHTS_INSTRUMENTATIONKEY              = "${azurerm_application_insights.prod.instrumentation_key}"
    FUNCTIONS_EXTENSION_VERSION                 = "~2"
    FUNCTIONS_WORKER_RUNTIME                    = "dotnet"
    WEBSITE_CONTENTAZUREFILECONNECTIONSTRING    = "${azurerm_storage_account.prod.primary_connection_string}"
    WEBSITE_CONTENTSHARE                        = "${var.storage_account_name}"
  }
  site_config {
    always_on   = "true"
  }
}