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
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"
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"
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"
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"
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"
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
Parameters
-
filesystem_name
required - string -
group
optional computed - string -
id
optional computed - string -
owner
optional computed - string -
path
required - string -
resource
required - string -
storage_account_id
required - string -
ace
set block-
id
optional - string -
permissions
required - string -
scope
optional - string -
type
required - string
-
-
timeouts
single block
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 areStorage 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.
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.
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.
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.