Terraform 和 Azure:无法配置存储帐户
Terraform and Azure: Unable to provision Storage Account
我正在尝试配置存储帐户,但 运行 它导致错误:
Error: Error reading static website for AzureRM Storage Account "sa12345461234512name":
accounts.Client#GetServiceProperties:
Failure responding to request: StatusCode=403 -- Original Error: autorest/azure:
Service returned an error. Status=403 Code="AuthorizationPermissionMismatch"
Message="This request is not authorized to perform this operation using this permission.\n
RequestId:05930d46-301e-00ac-6d72-f021f0000000\n
Time:2020-03-02T09:09:44.9417598Z"
运行 OS Windows 10 临.
复制步骤(在安装了 Azure CLI 的 Powershell 中)
- az 登录
- mkdir 虚拟文件夹
- cd 虚拟文件夹
- 创建config.tf
- 地形初始化
- 地形规划
- 地形应用-自动批准
Config.tf 内容
# Configure the Azure Provider
provider "azurerm" {
version = "=2.0.0"
features {}
}
resource "azurerm_resource_group" "example" {
name = "example-resources"
location = "Australia East"
}
resource "azurerm_storage_account" "example" {
name = "sa12345461234512name"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
account_tier = "Standard"
account_replication_type = "LRS"
tags = {
environment = "staging"
}
}
不确定我缺少什么,所有其他资源都可以正常工作,只有存储帐户。
发现问题。它与 Terraform 有关。
刚刚检查了更新和通知 0.12.21 已经出来了(我正在运行 0.12.20)。
似乎如果 运行 AzureARM 2.0.0 确实需要最小 0.12.21 才能使其工作。
这是 azure 提供程序中的错误,请参阅:https://github.com/terraform-providers/terraform-provider-azurerm/issues/5869
更新您的提供商;好像跟terraform版本没有关系。
发件人:
# Configure the Azure Provider
provider "azurerm" {
# whilst the `version` attribute is optional, we recommend pinning to a given version of the Provider
version = "=2.0.0"
features {}
}
收件人:
provider "azurerm" {
version = "~> 2.1.0"
features {}
}
只是补充一下,因为上面的 none 有效。在我的情况下,它首先没有工作,然后第二天工作只是在晚上再次工作......没有改变版本或任何东西,是同一台计算机。
原来我在 Ubuntu 运行 上 Windows 的时间设置有偏差。只需 运行 一个 sudo ntpdate time.nist.gov
更新时间就解决了问题。
与 遇到的问题相同。
在我的 Ubuntu WSL2 上,以下命令解决了问题:
sudo hwclock -s
我正在尝试配置存储帐户,但 运行 它导致错误:
Error: Error reading static website for AzureRM Storage Account "sa12345461234512name":
accounts.Client#GetServiceProperties:
Failure responding to request: StatusCode=403 -- Original Error: autorest/azure:
Service returned an error. Status=403 Code="AuthorizationPermissionMismatch"
Message="This request is not authorized to perform this operation using this permission.\n
RequestId:05930d46-301e-00ac-6d72-f021f0000000\n
Time:2020-03-02T09:09:44.9417598Z"
运行 OS Windows 10 临.
复制步骤(在安装了 Azure CLI 的 Powershell 中)
- az 登录
- mkdir 虚拟文件夹
- cd 虚拟文件夹
- 创建config.tf
- 地形初始化
- 地形规划
- 地形应用-自动批准
Config.tf 内容
# Configure the Azure Provider
provider "azurerm" {
version = "=2.0.0"
features {}
}
resource "azurerm_resource_group" "example" {
name = "example-resources"
location = "Australia East"
}
resource "azurerm_storage_account" "example" {
name = "sa12345461234512name"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
account_tier = "Standard"
account_replication_type = "LRS"
tags = {
environment = "staging"
}
}
不确定我缺少什么,所有其他资源都可以正常工作,只有存储帐户。
发现问题。它与 Terraform 有关。 刚刚检查了更新和通知 0.12.21 已经出来了(我正在运行 0.12.20)。
似乎如果 运行 AzureARM 2.0.0 确实需要最小 0.12.21 才能使其工作。
这是 azure 提供程序中的错误,请参阅:https://github.com/terraform-providers/terraform-provider-azurerm/issues/5869
更新您的提供商;好像跟terraform版本没有关系。
发件人:
# Configure the Azure Provider
provider "azurerm" {
# whilst the `version` attribute is optional, we recommend pinning to a given version of the Provider
version = "=2.0.0"
features {}
}
收件人:
provider "azurerm" {
version = "~> 2.1.0"
features {}
}
只是补充一下,因为上面的 none 有效。在我的情况下,它首先没有工作,然后第二天工作只是在晚上再次工作......没有改变版本或任何东西,是同一台计算机。
原来我在 Ubuntu 运行 上 Windows 的时间设置有偏差。只需 运行 一个 sudo ntpdate time.nist.gov
更新时间就解决了问题。
与
sudo hwclock -s