CloudNationHQ / terraform-azure-sa

Terraform module which creates storage resources used by workloads and accelerators.
https://library.tf/modules/CloudNationHQ/sa/azure/latest
MIT License
1 stars 2 forks source link

[REQUEST] - Add azurerm_storage_data_lake_gen2_filesystem for ADLS gen 2 storage accounts #95

Closed eddy-vera closed 1 month ago

eddy-vera commented 1 month ago

Is there an existing issue for this?

Description

For ADLS gen 2 storage accounts (when hierarchical namespacing is enabled), file systems (similar to containers in blobs) can be created. Therefore, the azurerm_storage_data_lake_gen2_filesystem resource needs to be added to this module.

Potential Terraform Configuration

main.tf

# file systems
resource "azurerm_storage_data_lake_gen2_filesystem" "fs" {
  for_each = {
    for fs in local.file_systems : fs.fs_key => fs
  }

name                     = each.value.name
storage_account_id       = each.value.storage_account_id
default_encryption_scope = each.value.default_encryption_scope
properties               = each.value.properties
owner                    = each.value.owner
group                    = each.value.group
ace                      = each.value.ace
}

locals.tf

locals {
  file_systems = flatten([
    for fs_key, fs in try(var.storage.file_systems, {}) : {

      fs_key                    = fs_key
      name                      = try(fs.name, join("-", [var.naming.file_system, fs_key]))
      storage_account_id        = azurerm_storage_account.sa.id
      properties                = try(fs.properties, {})
      owner                     = try(fs.owner, null)
      group                     = try(fs.group, null)
      ace                       = try(fs.ace, {})
      default_encryption_scope  = try(fs.default_encryption_scope, null)
    }
  ])
}

References

No response

eddy-vera commented 1 month ago

Also azurerm_storage_data_lake_gen2_path will be added as a resource, which is a child resource of the file systems. These resources will be added as outputs as well.