简体   繁体   English

Terraform无法在Azure中创建存储帐户

[英]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问题。

Edit 编辑

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.

相关问题 使用Azure的Terraform-如何创建存储帐户? - Terraform with Azure - How to create Storage Account? 将现有 Azure 存储帐户导入 Terraform 资源 - Importing Existing Azure Storage Account Into Terraform Resource terraform 嵌套在 azure 存储帐户中的每个循环 - terraform nested for each loop in azure storage account Terraform 设置 azure 存储帐户 virtual.network - Terraform set azure storage account virtual network Terraform 和 Azure:无法配置存储帐户 - Terraform and Azure: Unable to provision Storage Account 从 Terraform 在 Azure 存储帐户中设置 CORS - Setting CORS in Azure storage account from Terraform 在 Terraform 中为 Azure 存储帐户创建事件订阅 - Creating an event subscription for Azure storage account in Terraform Azure 存储帐户中的版本化 Terraform 状态 - Versioning Terraform state in Azure storage account Azure存储帐户的价格是每个帐户还是单个价格,并且可以创建多个存储帐户? - Will Azure storage account prices per account or will it be single price and can create multiple storage account? 有没有办法使用 terraform 为 azure 日志分析中的虚拟机、存储帐户资源创建警报 - is there a way to create alerts for virtual machine, storage account resources in azure log analytics using terraform
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM