forked from claranet/terraform-azurerm-storage-account
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathr-file-shares.tf
36 lines (29 loc) · 1.01 KB
/
r-file-shares.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
resource "azurerm_storage_share" "share" {
for_each = try({ for s in var.file_shares : s.name => s }, {})
storage_account_name = azurerm_storage_account.storage.name
name = each.key
quota = each.value.quota_in_gb
enabled_protocol = each.value.enabled_protocol
metadata = each.value.metadata
dynamic "acl" {
for_each = each.value.acl != null ? each.value.acl : []
content {
id = acl.value.id
access_policy {
permissions = acl.value.permissions
start = acl.value.start
expiry = acl.value.expiry
}
}
}
lifecycle {
precondition {
condition = each.value.enabled_protocol == "NFS" ? var.account_tier == "Premium" : true
error_message = "NFS file shares can only be enabled on Premium Storage Accounts."
}
precondition {
condition = var.account_tier != "Premium" || each.value.quota_in_gb >= 100
error_message = "File share quota must be at least 100Gb for Premium Storage Accounts."
}
}
}