【问题标题】:The argument "storage_connection_string" is required, but no definition was found参数“storage_connection_string”是必需的,但没有找到定义
【发布时间】:2021-03-26 23:55:51
【问题描述】:

我目前正在尝试使用 Terraform 设置 Azure Function 应用程序。

使用从 Hasihcorp 找到的文档here

但是,当运行 terraform plan 时,我收到以下错误:The argument "storage_connection_string" is required, but no definition was found.

根据文档,没有这样的有效参数,因此我没有包含它。我在四处寻找时只找到了一个条目,这只是一个问题,没有回应。我对 Azure 不太熟悉,所以不知道我是否需要 storage_connection_string 或者它是否是困扰我的 API。

资源sn-p:

resource "azurerm_function_app" "this" {
  name = "function-name"
  resource_group_name = "resource-group"
  location = "location"
  app_service_plan_id = "id"
  storage_account_name = "name"
  storage_account_access_key = "key"

设置了值的格式和引用,但我在这台计算机上没有代码,所以像这样发布它更有意义。

【问题讨论】:

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


    【解决方案1】:

    这很可能是由于使用了过期版本的 azure 提供程序。例如。 version 2.0.0 具有必需的 storage_connection_string。这已在 一些 版本中删除。

    解决方案:升级您使用的提供程序版本。您应该在某个地方声明要使用 azure 提供程序。在那个地方你也应该指定一个version constraint,例如:

    terraform {
      required_providers {
        azure = {
          version = "~> 2.40.0"
        }
      }
    }
    

    或者,您应该只查看与您当前提供者 + terraform 版本相匹配的文档。

    【讨论】:

    • 谢谢!这是正确的。我使用的是 2.2.0 版本。它现在可以工作了。
    猜你喜欢
    • 1970-01-01
    • 2021-01-29
    • 1970-01-01
    • 1970-01-01
    • 2022-12-04
    • 2019-03-18
    • 1970-01-01
    • 2019-02-04
    • 2021-09-05
    相关资源
    最近更新 更多