我正在尝试执行 Terraform init,但收到以下错误
│ Error: Failed to get existing workspaces: Error retrieving keys for Storage Account "stmpltfstateprdcus001": storage.AccountsClient#ListKeys: Failure responding to request: StatusCode=404 -- Original Error: autorest/azure: Service returned an error. Status=404 Code="ResourceGroupNotFound" Message="Resource group 'rg-terraform-prod-centralus-001' could not be found."
这是我的后端配置:
terraform {
required_version = "~> 1.0"
required_providers {
azuread = "~> 3.0"
azurerm = "~> 4.0"
}
backend "azurerm" {
resource_group_name = "rg-terraform-prod-centralus-001"
storage_account_name = "stmpltfstateprdcus001"
container_name = "terraform"
key = "mg-PLATFORM-repo-Azure_Lz_Core-branch-main-template-platform_landing_zone.tfstate"
}
}
我已使用我的帐户登录到 Azure,并且可以看到存储帐户访问密钥。我有完全访问权限
那么这里的问题是什么
在通过当前帐户运行
terraform init
之前,您需要在同一命令行会话中进行授权:
az login