gpt4 book ai didi

azure - 尝试创建 azure 函数时出错 - 使用 terraform 的消费计划

转载 作者:行者123 更新时间:2023-12-03 01:25:04 25 4
gpt4 key购买 nike

我正在遵循官方示例:

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

provider "azurerm" {
# Configuration options
}

resource "azurerm_resource_group" "example" {
name = "azure-functions-cptest-rg"
location = "West Europe"
}

resource "azurerm_storage_account" "example" {
name = "functionsapptestsa"
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
kind = "FunctionApp"

sku {
tier = "Dynamic"
size = "Y1"
}
}

resource "azurerm_function_app" "example" {
name = "test-azure-functions"
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
}

https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/function_app#example-usage-in-a-consumption-plan

当我运行 terraform validate 时,它​​通过了,但是当我尝试应用时它说:

此处不需要名为“storage_account_access_key”的参数。

此处不应出现名为“storage_account_name”的参数。

有什么线索吗?

最佳答案

您需要升级您的 Azure 提供商。对 storage_account_namestorage_account_access_key 的支持was added in version 2.7 .

当前版本是2.51。

您可以尝试使用以下方式进行升级:

terraform init -upgrade

没有-upgrade TF 不会upgrade现有模块:

Re-running init with modules already installed will install the sources for any modules that were added to configuration since the last init, but will not change any already-installed modules.

关于azure - 尝试创建 azure 函数时出错 - 使用 terraform 的消费计划,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66631158/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com