Skip to content

aztfm/terraform-azurerm-storage-account

Repository files navigation

Azure Storage Account - Terraform Module

pre-commit Terraform Registry Dev Container GitHub License GitHub release (latest by date)

Open in GitHub Codespaces

⚙️ Version compatibility

Module version Terraform version hashicorp/azurerm version
>= 1.0.0 >= 1.9.x ~>4.0

📝 Usage

resource "azurerm_resource_group" "rg" {
  name     = "resource-group"
  location = "Spain Central"
}

module "storage_account" {
  source                   = "aztfm/storage-account/azurerm"
  version                  = ">=1.0.0"
  name                     = "storageaccount"
  resource_group_name      = azurerm_resource_group.rg.name
  location                 = azurerm_resource_group.rg.location
  account_tier             = "Standard"
  account_replication_type = "ZRS"
}

Reference to more examples.

▶️ Parameters

The module supports the next parameters:

Name Description Type Default Required
name The name of the Storage Account. string n/a yes
resource_group_name The name of the resource group in which to create the Storage Account. string n/a yes
location The location/region where the Storage Account is created. string n/a yes
tags A mapping of tags to assign to the resource. map(string) {} no
account_tier Defines the Tier to use for this storage account. Valid options are Standard and Premium. string n/a yes
account_kind Defines the Kind to use for this storage account. Valid options are Storage, StorageV2, BlobStorage, FileStorage, BlockBlobStorage. string "StorageV2" no
account_replication_type Defines the type of replication to use for this storage account. Valid options are LRS, GRS, RAGRS, ZRS, GZRS and RAGZRS. Changing this forces a new resource to be created when types LRS, GRS and RAGRS are changed to ZRS, GZRS or RAGZRS and vice versa. string n/a yes
https_traffic_only_enabled Allows https traffic only to storage service if set to true. bool true no
min_tls_version The minimum supported TLS version for the storage account. Valid values are TLS1_0, TLS1_1, TLS1_2. string "TLS1_2" no
public_network_access_enabled Controls whether data on the public internet is allowed to be read or written to the storage account. bool true no
containers A list of containers to create within the Storage Account. list(object({})) [] no
file_shares A list of file shares to create within the Storage Account. list(object({})) [] no

The containers supports the next parameters:

Name Description Type Default Required
name The name of the Container which should be created within the Storage Account string n/a yes
container_access_type The Access Level configured for this Container. Possible values are blob, container and private. string private no

The file_shares supports the next parameters:

Name Description Type Default Required
name The name of the File Share which should be created within the Storage Account string n/a yes
access_tier The Access Tier configured for this File Share. Possible values are Hot, Cool, TransactionOptimized and Premium. string Hot no
quota_in_gb The maximum size of the File Share in GB. This must be between 1 and 5120 GB inclusive integer n/a yes

◀️ Outputs

The module supports the next outputs:

Name Description Sensitive
id The ID of the Storage Account. no
name The name of the Storage Account. no
resource_group_name The resource group name of the Storage Account. no
location The location of the Storage Account. no
tags The tags of the Storage Account. no
containers The containers within the Storage Account. no
file_shares The file shares within the Storage Account. no