Azure Public access level for containers

Hi, I’m trying to change container_access_type value from “private”, but I keep getting an error.

Please assist, thanks.

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”

It is working using 2.26 version:

terraform {
  required_providers {
    azurerm = {
      source  = "hashicorp/azurerm"
      version = ">= 2.26"
    }
  }

  required_version = ">= 0.14.9"
}

provider "azurerm" {
  features {}
}

data "terraform_remote_state" "resource_groups" {
  backend = "local"

  config = {
    path = "../1-resource-group/terraform.tfstate"
  }
}

resource "azurerm_storage_account" "demo_storage" {
  name                      = var.storage_account_name
  resource_group_name       = data.terraform_remote_state.resource_groups.outputs.demo_rg_name
  location                  = data.terraform_remote_state.resource_groups.outputs.demo_rg_location
  account_tier              = "Standard"
  account_replication_type  = "LRS"

  allow_blob_public_access  = true

  tags = {
    Environment = "Demo"
    Team        = "Ellipse"
  }
}

resource "azurerm_storage_container" "demo_document_container" {
  name                  = var.document_container_name
  storage_account_name  = azurerm_storage_account.demo_storage.name
  container_access_type = "container"
}