我尝试将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" {
...
...
...
}
在main.tf文件中。
关于azure - Terraform Azure 提供程序 - 容器的 Azure 公共(public)访问级别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63825315/