Azure存储:检查现有存储共享是否存在时出错

Azure存储:检查现有存储共享是否存在时出错,azure,terraform,azure-storage,terraform-provider-azure,Azure,Terraform,Azure Storage,Terraform Provider Azure,我正在尝试使用Terraform设置Azure存储帐户和文件共享: resource "random_pet" "prefix" {} provider "azurerm" { version = "~>2.25.0" features {} } resource "azurerm_resource_group" "default" { name

我正在尝试使用Terraform设置Azure存储帐户和文件共享:

resource "random_pet" "prefix" {}

provider "azurerm" {
  version = "~>2.25.0"
  features {}
}

resource "azurerm_resource_group" "default" {
  name     = "${random_pet.prefix.id}-rg"
  location = "australiaeast"
}


resource "azurerm_storage_account" "default" {
  name                = replace("${random_pet.prefix.id}storage", "-", "")
  resource_group_name = azurerm_resource_group.default.name
  location            = azurerm_resource_group.default.location
  account_tier        = "Premium"
  account_replication_type = "LRS"
}

resource "azurerm_storage_share" "default" {
  name = "${azurerm_storage_account.default.name}share"
  storage_account_name = azurerm_storage_account.default.name
}
但是,我在尝试应用时遇到以下错误:

Error: Error checking for existence of existing Storage Share "patientducklingstorageshare" (Account "patientducklingstorage" / Resource Group "patient-duckling-rg"): shares.Client#GetProperties: Failure sending request: StatusCode=0 -- Original Error: Get "https://patientducklingstorage.file.core.windows.net/patientducklingstorageshare?restype=share": dial tcp: lookup patientducklingstorage.file.core.windows.net on 192.168.1.1:53: no such host

  on aks-cluster.tf line 22, in resource "azurerm_storage_share" "default":
  61: resource "azurerm_storage_share" "default" {
``

通过运行
terraforminit

解决了此问题。通过运行
terraforminit
解决了此问题