azure - Terraform Azure 提供程序 - 容器的 Azure 公共(public)访问级别

标签 azure containers terraform-provider-azure

我尝试将container_access_type值从“private”更改,但我不断收到错误消息。

我可以从 Azure UI 执行此操作。 Terraform 代码中可能缺少某些内容。

请帮忙,谢谢。

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

resource "azurerm_resource_group" "storage" {
  name     = "tfstorageresourcegroup"
  location = "North Europe"
}

resource "azurerm_storage_account" "account" {
  name = "${azurerm_resource_group.storage.name}"
  location = "${azurerm_resource_group.storage.location}"
  account_tier = "Standard"
  resource_group_name = "${azurerm_resource_group.storage.name}"
  account_replication_type = "LRS"
  enable_https_traffic_only = true
  allow_blob_public_access = true
}


resource "azurerm_storage_container" "container" {
    name = "tftestcontainer"
    storage_account_name = "${azurerm_storage_account.account.name}"
    container_access_type = "container"
}

resource "azurerm_storage_blob" "blob" {
    name = "tftestblob"
    storage_account_name = "${azurerm_storage_account.account.name}"
    storage_container_name = "${azurerm_storage_container.container.name}"
    type = "Page"
    size = "5120"
}

Error: Error updating the Access Control for Container “tftestcontainer” (Storage Account “tfstorageresourcegroup” / Resource Group “tfstorageresourcegroup”): containers.Client#SetAccessControl: Failure sending request: StatusCode=409 – Original Error: autorest/azure: Service returned an error. Status= Code=“PublicAccessNotPermitted” Message=“Public access is not permitted on this storage account.\nRequestId:80d021ca-501e-009f-4aa6-86a404000000\nTime:2020-09-09T12:38:47.5769058Z”

最佳答案

我在使用 terraform 创建 azure 基础设施时遇到了同样的错误。

我编辑的目的是:

  container_access_type = "private"

内部:

    resource "azurerm_storage_container" "container" {
     ...
     ...
     ...
    }

ma​​in.tf文件中。

关于azure - Terraform Azure 提供程序 - 容器的 Azure 公共(public)访问级别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63825315/

相关文章:

c++ - CTypedPtrArray 和 CArray 的区别

azure - 如何将全局管理员角色分配给 Azure 中的服务主体?

terraform - 如何忽略 block 中属性的更改

c# - 使用 Azure 移动服务 .Net 后端仅进行推送

Azure ExpressRoute 私有(private)对等互连 : 2 BGP Sessions or 1 on a single VC?

azure - 在处理数据时如何在 Azure HDInsight 中实现数据分布

Azure存储: BlobClient keeps resetting itself while uploading large files

docker - 用于运行 Bluemix 容器的本地主机文件的等效项

java - 如何在Servlet中找到监听器?

azure - 使用 azure CLI 的 Terraform - 构建帐户时出错