[英]Terraform can not create a storage account in Azure
I have a Terraform script that used to be able to create a storage account in Azure ok, but today started to return the error message: 我有一个Terraform脚本,该脚本曾经能够在Azure中创建存储帐户,但今天开始返回错误消息:
azurerm_storage_account.testsa: 1 error(s) occurred:
* azurerm_storage_account.testsa: Error waiting for Azure Storage Account "terraformtesthubb" to be created: Future#WaitForCompletion: the number of retries has been exceeded: StatusCode=400 -- Original Error: Code="AadClientCredentialsGrantFailure" Message="Failure in AAD Client Credentials Grant Flow."
The trace logs don't show anything useful, and the term AadClientCredentialsGrantFailure
literally returns nothing in Google. 跟踪日志没有显示任何有用的信息,术语AadClientCredentialsGrantFailure
在Google中实际上不返回任何内容。 What is the cause? 原因是什么?
Answering this one for myself because Google totally failed me. 我自己回答这个问题,因为Google完全使我失望。
This turned out to be an issue with Azure. 原来这是Azure的问题。 Despite there being no errors listed in any of the status pages, the script would work in US West, but fail in US West 2. 尽管在任何状态页面中都未列出任何错误,但该脚本在美国西部地区仍然可以运行,但在美国西部地区却无法运行。
After a few days this issue went away, so it was an intermittent Azure issue. 几天后,这个问题消失了,所以这是一个间歇性的Azure问题。
For reference, this was the script. 供参考,这是脚本。 Markers like #{Principal.TenantId}
are being replaced during the template deployment. 在模板部署期间,将替换#{Principal.TenantId}
类的标记。
provider "azurerm" {
client_id = "#{Principal.Client}"
client_secret = "#{Principal.Password}"
subscription_id = "#{Principal.SubscriptionNumber}"
tenant_id = "#{Principal.TenantId}"
}
resource "azurerm_resource_group" "testrg" {
name = "terraformtesthub#{Octopus.Environment.Name | ToLower}"
location = "#{Octopus.Environment.Name | ToLower}"
}
resource "azurerm_virtual_network" "test" {
name = "terraformtesthub#{Octopus.Environment.Name | ToLower}"
address_space = ["10.0.0.0/16"]
location = "${azurerm_resource_group.testrg.location}"
resource_group_name = "${azurerm_resource_group.testrg.name}"
}
resource "azurerm_subnet" "test" {
name = "terraformtesthub#{Octopus.Environment.Name | ToLower}"
resource_group_name = "${azurerm_resource_group.testrg.name}"
virtual_network_name = "${azurerm_virtual_network.test.name}"
address_prefix = "10.0.2.0/24"
service_endpoints = ["Microsoft.Sql", "Microsoft.Storage"]
}
resource "azurerm_storage_account" "testsa" {
name = "terraformtesthub#{Octopus.Environment.Name | ToLower}"
resource_group_name = "${azurerm_resource_group.testrg.name}"
location = "#{Octopus.Environment.Name | ToLower}"
account_tier = "Standard"
account_kind = "StorageV2"
account_replication_type = "RAGRS"
lifecycle {
prevent_destroy = true
}
network_rules {
ip_rules = ["100.0.0.1"]
virtual_network_subnet_ids = ["${azurerm_subnet.test.id}"]
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.