【问题标题】:Issue in deploying azure function through terraform with app settings使用应用程序设置通过 terraform 部署 azure 功能的问题
【发布时间】:2022-06-15 19:04:24
【问题描述】:

我正在关注此文档页面以使用应用设置部署 azure 功能https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/function_app

我的 terraform 文件如下所示:

terraform {
  required_providers {
    azurerm = {
      source  = "hashicorp/azurerm"
      version = "3.10.0"
    }
  }
}

provider "azurerm" {
}
resource "azurerm_resource_group" "example" {
  name     = "azure-functions-test-rg"
  location = "West Europe"
}

resource "azurerm_storage_account" "example" {
  name                     = "funcdemo123shafiq"
  resource_group_name      = azurerm_resource_group.example.name
  location                 = azurerm_resource_group.example.location
  account_tier             = "Standard"
  account_replication_type = "LRS"
}

resource "azurerm_app_service_plan" "example" {
  name                = "azure-functions-test-service-plan"
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name

  sku {
    tier = "Standard"
    size = "S1"
  }
}

resource "azurerm_function_app" "example" {
  name                       = "test-azure-shafiq123"
  location                   = azurerm_resource_group.example.location
  resource_group_name        = azurerm_resource_group.example.name
  app_service_plan_id        = azurerm_app_service_plan.example.id
  storage_account_name       = azurerm_storage_account.example.name
  storage_account_access_key = azurerm_storage_account.example.primary_access_key
  os_type                    = "linux"
  version                    = "~4"

  app_settings {
    FUNCTIONS_WORKER_RUNTIME = "python"
    TESTING_KEY              = "TESTING_VALUE"
  }

  site_config {
    linux_fx_version = "python|3.9"
  }
}

当尝试通过terraform apply 命令部署它时,我收到了这个错误。

│ Error: Unsupported block type
│
│   on main.tf line 46, in resource "azurerm_function_app" "example":
│   46:   app_settings {
│
│ Blocks of type "app_settings" are not expected here. Did you mean to define argument "app_settings"? If so, use the equals sign to assign it a value.

【问题讨论】:

  • 您对错误消息有什么不清楚的地方?

标签: azure terraform azure-functions terraform-provider-azure


猜你喜欢
  • 2020-10-16
  • 1970-01-01
  • 2018-12-21
  • 2023-01-17
  • 2019-10-20
  • 2021-11-14
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多