Azure Blob Storage - create folder in storage container

Within Azure Blob Storage --> Storage Container (in the Azure UI) there is a way to upload a blob to the storage container and store that upload in folder.

Using Terraform, I currently don’t see an option to create a sub-folder within a storage container, and to use that sub-folder in the ‘Source’ of the azurerm_storage_blob item to store sources in sub-folders.

Is this currently being worked on?

If not, is it possible to get votes on it to get it in the backlog?

1 Like

Hi,

In such a case you should specify path to Blob that will be uploaded including all needed folder structure, e.g. test_folder/new-folder/test.bmp

Using terraform you can upload Blob with folder structure specified above via next simple resource definition:

resource "azurerm_storage_blob" "example" {

  name                   = "test_folder/new-folder/test.bmp"

  storage_account_name   = "tfexamplesa"

  storage_container_name = "test"

  type                   = "Block"

  source                 = "test.bmp"

} 

Using Azure portal it looks like this:

is it possible to create multiple root folders for a container?