Manages a File Share within Azure Storage.
resource "azurerm_resource_group" "example" {
name = "azuretest"
location = "West Europe"
}
resource "azurerm_storage_account" "example" {
name = "azureteststorage"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
account_tier = "Standard"
account_replication_type = "LRS"
}
resource "azurerm_storage_share" "example" {
name = "sharename"
storage_account_name = azurerm_storage_account.example.name
quota = 50
acl {
id = "MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI"
access_policy {
permissions = "rwdl"
start = "2019-07-02T09:38:21.0000000Z"
expiry = "2019-07-02T10:38:21.0000000Z"
}
}
}
The following arguments are supported:
name
- (Required) The name of the share. Must be unique within the storage account where the share is located. Changing this forces a new resource to be created.
storage_account_name
- (Required) Specifies the storage account in which to create the share. Changing this forces a new resource to be created.
access_tier
- (Optional) The access tier of the File Share. Possible values are Hot
, Cool
and TransactionOptimized
, Premium
.
~>NOTE: The FileStorage
account_kind
of the azurerm_storage_account
requires Premium
access_tier
.
acl
- (Optional) One or more acl
blocks as defined below.
enabled_protocol
- (Optional) The protocol used for the share. Possible values are SMB
and NFS
. The SMB
indicates the share can be accessed by SMBv3.0, SMBv2.1 and REST. The NFS
indicates the share can be accessed by NFSv4.1. Defaults to SMB
. Changing this forces a new resource to be created.
~>NOTE: The FileStorage
account_kind
of the azurerm_storage_account
is required for the NFS
protocol.
quota
- (Required) The maximum size of the share, in gigabytes.~>NOTE: For Standard storage accounts, by default this must be 1
GB (or higher) and at most 5120
GB (5
TB). This can be set to a value larger than 5120
GB if large_file_share_enabled
is set to true
in the parent azurerm_storage_account
.
~>NOTE: For Premium FileStorage storage accounts, this must be greater than 100
GB and at most 102400
GB (100
TB).
metadata
- (Optional) A mapping of MetaData for this File Share.A acl
block supports the following:
id
- (Required) The ID which should be used for this Shared Identifier.
access_policy
- (Optional) An access_policy
block as defined below.
A access_policy
block supports the following:
permissions
- (Required) The permissions which should be associated with this Shared Identifier. Possible value is combination of r
(read), w
(write), d
(delete), and l
(list).start
- (Optional) The time at which this Access Policy should be valid from, in ISO8601 format.
expiry
- (Optional) The time at which this Access Policy should be valid until, in ISO8601 format.
In addition to the Arguments listed above - the following Attributes are exported:
id
- The ID of the File Share.
resource_manager_id
- The Resource Manager ID of this File Share.
url
- The URL of the File Share
The timeouts
block allows you to specify timeouts for certain actions:
create
- (Defaults to 30 minutes) Used when creating the Storage Share.update
- (Defaults to 30 minutes) Used when updating the Storage Share.read
- (Defaults to 5 minutes) Used when retrieving the Storage Share.delete
- (Defaults to 30 minutes) Used when deleting the Storage Share.Storage Shares can be imported using the resource id
, e.g.
terraform import azurerm_storage_share.exampleShare https://account1.file.core.windows.net/share1