尝试创建 azure 函数时出错 - 使用 terraform 的消费计划
error when trying to create azure functions - consumption plan with terraform
我正在关注官方示例:
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
}
当我 运行 terraform 验证时,它通过了,但是当我尝试应用它时说:
这里不需要名为“storage_account_access_key”的参数。
和
这里不需要名为“storage_account_name”的参数。
有什么线索吗?
您需要升级您的 Azure 提供商。支持 storage_account_name
和 storage_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.
我尝试了相同的代码,它对我有用
Terraform v0.14.7
+ provider registry.terraform.io/hashicorp/azurerm v2.51.0
您可以考虑升级您的terraform 版本。参见 Download Terraform。
我正在关注官方示例:
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
}
当我 运行 terraform 验证时,它通过了,但是当我尝试应用它时说:
这里不需要名为“storage_account_access_key”的参数。
和
这里不需要名为“storage_account_name”的参数。
有什么线索吗?
您需要升级您的 Azure 提供商。支持 storage_account_name
和 storage_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.
我尝试了相同的代码,它对我有用
Terraform v0.14.7
+ provider registry.terraform.io/hashicorp/azurerm v2.51.0
您可以考虑升级您的terraform 版本。参见 Download Terraform。