Azure Storage Share
This page shows how to write Terraform for Storage Share and write them securely.
azurerm_storage_share (Terraform)
The Share in Storage can be configured in Terraform with the resource name azurerm_storage_share
. The following sections describe 10 examples of how to use the resource and its parameters.
Example Usage from GitHub
resource "azurerm_storage_share" "smb1" {
name = "backup"
storage_account_name = azurerm_storage_account.stga1.name
quota = 50
}
resource "azurerm_storage_share" "storageshare_database" {
name = "database"
storage_account_name = azurerm_storage_account.storageaccount.name
quota = 5
}
resource "azurerm_storage_share" "file_share" {
name = "online-models"
storage_account_name = azurerm_storage_account.storage_account.name
quota = 50 # max size of file_share in Gb
}
resource "azurerm_storage_share" "minecraft_world" {
name = "world"
storage_account_name = azurerm_storage_account.minecraft.name
quota = 50
}
resource "azurerm_storage_share" "dags_share" {
name = "airflow-dags"
storage_account_name = azurerm_storage_account.sa.name
quota = 50
}
resource "azurerm_storage_share" "config" {
name = "config"
storage_account_name = azurerm_storage_account.acserver_store.name
quota = 10
}
resource "azurerm_storage_share" "in_fw_palo_fileshare" {
name = var.in_fw_bootstrap_file_share
storage_account_name = azurerm_storage_account.fwinbootstrapstor.name
quota = 1
}
resource "azurerm_storage_share" "out_fw_palo_fileshare" {
resource "azurerm_storage_share" "homes" {
name = "homes"
storage_account_name = azurerm_storage_account.homes.name
quota = 100
}
resource "azurerm_storage_share" "lab" {
name = "terraformshare8023"
storage_account_name = azurerm_storage_account.lab.name
quota = 50
}
resource "azurerm_storage_share" "lab" {
name = "terraformshare"
storage_account_name = azurerm_storage_account.lab.name
quota = 50
}
Parameters
-
id
optional computed - string -
metadata
optional computed - map from string to string -
name
required - string -
quota
optional - number -
resource_manager_id
optional computed - string -
storage_account_name
required - string -
url
optional computed - string -
acl
set block-
id
required - string -
access_policy
list block-
expiry
optional - string -
permissions
required - string -
start
optional - string
-
-
-
timeouts
single block
Explanation in Terraform Registry
Manages a File Share within Azure Storage.
Note: The storage share supports two storage tiers: premium and standard. Standard file shares are created in general purpose (GPv1 or GPv2) storage accounts and premium file shares are created in FileStorage storage accounts. For further information, refer to the section "What storage tiers are supported in Azure Files?" of documentation.
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 Share?
Azure Storage Share 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 Share?
For Terraform, the Gabbi68/Infrastructure, cbchalmers/Azure-PaaS-WebApp-Docker-Compose-Wordpress and bchen012/ntu_asr source code examples are useful. See the Terraform Example section for further details.