Azure Storage Data Lake Gen2 Path

This page shows how to write Terraform for Storage Data Lake Gen2 Path and write them securely.

azurerm_storage_data_lake_gen2_path (Terraform)

The Data Lake Gen2 Path in Storage can be configured in Terraform with the resource name azurerm_storage_data_lake_gen2_path. The following sections describe 6 examples of how to use the resource and its parameters.

Example Usage from GitHub

main.tf#L36
resource "azurerm_storage_data_lake_gen2_path" "raw" {
  for_each           = toset(["ltc/unity", "premium rate increase/prism"])
  path               = each.key
  filesystem_name    = azurerm_storage_data_lake_gen2_filesystem.container["raw"].name
  storage_account_id = data.azurerm_storage_account.storage_account.id
  resource           = "directory"
main.tf#L137
resource "azurerm_storage_data_lake_gen2_path" "prod" {
  count              = length(var.prod-dir)
  path               = var.prod-dir[count.index]
  filesystem_name    = azurerm_storage_data_lake_gen2_filesystem.prod.name
  storage_account_id = data.azurerm_storage_account.DL.id
  resource           = "directory"
08%20-%20services.tf#L33
resource "azurerm_storage_data_lake_gen2_path" "storagedatalakepath" {
  path               = "datalakepath"
  filesystem_name    = azurerm_storage_data_lake_gen2_filesystem.storagedatalakefs.name
  storage_account_id = azurerm_storage_account.storageaccountproddl.id
  resource           = "directory"
template.tf#L28
resource "azurerm_storage_data_lake_gen2_path" "path" {
  for_each           = { for k, v in var.aci_mappings : k => v }
  path               = each.value.path
  filesystem_name    = azurerm_storage_data_lake_gen2_filesystem.datalakefs.name
  storage_account_id = azurerm_storage_account.datalake.id
  resource           = "directory"
main.tf#L98
resource "azurerm_storage_data_lake_gen2_path" "networkanalytics" {
  depends_on         = [azurerm_storage_data_lake_gen2_filesystem.datafiles]
  path               = "NetworkAnalytics"
  filesystem_name    = azurerm_storage_data_lake_gen2_filesystem.datafiles.name
  storage_account_id = azurerm_storage_account.datalake.id
  resource           = "directory"
main.tf#L20
resource "azurerm_storage_data_lake_gen2_path" "example" {
  count                = length(var.folder)
  path                 = var.folder[count.index]
  #path               = "example"
  filesystem_name    = azurerm_storage_data_lake_gen2_filesystem.dlakegen2.name
  storage_account_id = azurerm_storage_account.account1.id

Review your Terraform file for Azure best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

Explanation in Terraform Registry

Manages a Data Lake Gen2 Path in a File System within an Azure Storage Account.

NOTE: This resource requires some Storage specific roles which are not granted by default. Some of the built-ins roles that can be attributed are Storage Account Contributor, Storage Blob Data Owner, Storage Blob Data Contributor, Storage Blob Data Reader.

Tips: Best Practices for The Other Azure Storage Resources

In addition to the azurerm_storage_account, Azure Storage has the other resources that should be configured for security reasons. Please check some examples of those resources and precautions.

risk-label

azurerm_storage_account

Ensure to use HTTPS connections

It is better to use HTTPS instead of HTTP, which could be vulnerable to person-in-the-middle attacks.

risk-label

azurerm_storage_account_network_rules

Ensure to allow Trusted Microsoft Services to bypass

It is better to allow Trusted Microsoft Services to bypass. They are not able to access storage account unless rules are set to allow them explicitly.

Review your Azure Storage settings

In addition to the above, there are other security points you should be aware of making sure that your .tf files are protected in Shisho Cloud.

Azure Resource Manager Example

Azure Resource Manager code does not have the related resource.

Frequently asked questions

What is Azure Storage Data Lake Gen2 Path?

Azure Storage Data Lake Gen2 Path is a resource for Storage of Microsoft Azure. Settings can be wrote in Terraform.

Where can I find the example code for the Azure Storage Data Lake Gen2 Path?

For Terraform, the sahitya12/myrepo, Dmeehan81/Terraform-DataLake and paulocorreaslz/azure-hub-spoke-server source code examples are useful. See the Terraform Example section for further details.