Skip to content

Commit bb5d209

Browse files
authored
Merge pull request #21 from habr-mms/enhanced_settings_for_nfs
feat: Settings for nfs
2 parents 2162402 + 6396428 commit bb5d209

4 files changed

Lines changed: 38 additions & 18 deletions

File tree

examples/main.tf

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,18 @@ module "storage" {
1414
service = "service_name"
1515
}
1616
}
17+
filestorage = {
18+
name = "servicefilestg"
19+
resource_group_name = "service-infrastructure-rg"
20+
location = "westeurope"
21+
account_kind = "FileStorage"
22+
account_tier = "Premium"
23+
account_replication_type = "LRS"
24+
enable_https_traffic_only = false
25+
tags = {
26+
service = "service_name"
27+
}
28+
}
1729
}
1830
storage_container = {
1931
terraform = {
@@ -23,4 +35,12 @@ module "storage" {
2335
}
2436
}
2537
}
38+
storage_share = {
39+
nfsfiles = {
40+
storage_account_name = module.storage.storage_account.filestorage.name
41+
access_tier = "Premium"
42+
enabled_protocol = "NFS"
43+
quota = 100
44+
}
45+
}
2646
}

main.tf

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ resource "azurerm_storage_account" "storage_account" {
5252
}
5353

5454
dynamic "blob_properties" {
55-
for_each = local.storage_account[each.key].blob_properties != {} ? [1] : []
55+
for_each = local.storage_account[each.key].account_kind != "FileStorage" ? [1] : []
5656
content {
5757
versioning_enabled = local.storage_account[each.key].blob_properties.versioning_enabled
5858
change_feed_enabled = local.storage_account[each.key].blob_properties.change_feed_enabled
@@ -84,7 +84,7 @@ resource "azurerm_storage_account" "storage_account" {
8484
}
8585

8686
dynamic "queue_properties" {
87-
for_each = local.storage_account[each.key].queue_properties != {} ? [1] : []
87+
for_each = local.storage_account[each.key].queue_properties.cors_rule != {} || local.storage_account[each.key].queue_properties.logging != {} || local.storage_account[each.key].queue_properties.minute_metrics != {} || local.storage_account[each.key].queue_properties.hour_metrics != {} ? [1] : []
8888
content {
8989
dynamic "cors_rule" {
9090
for_each = local.storage_account[each.key].queue_properties.cors_rule
@@ -198,19 +198,21 @@ resource "azurerm_storage_share" "storage_share" {
198198
name = local.storage_share[each.key].name == "" ? each.key : local.storage_share[each.key].name
199199
metadata = local.storage_share[each.key].metadata
200200
storage_account_name = local.storage_share[each.key].storage_account_name
201+
access_tier = local.storage_share[each.key].access_tier
202+
enabled_protocol = local.storage_share[each.key].enabled_protocol
201203
quota = local.storage_share[each.key].quota
202204

203205
dynamic "acl" {
204-
for_each = local.storage_account[each.key].acl == true ? [1] : []
206+
for_each = local.storage_share[each.key].acl != {} ? [1] : []
205207
content {
206-
id = local.storage_account[each.key].acl[acl.key].id
208+
id = local.storage_share[each.key].acl[acl.key].id
207209

208210
dynamic "access_policy" {
209-
for_each = local.storage_account[each.key].acl[acl.key].access_policy
211+
for_each = local.storage_share[each.key].acl[acl.key].access_policy != {} ? [1] : []
210212
content {
211-
permissions = local.storage_account[each.key].acl[acl.key].access_policy[access_policy.key].permissions
212-
start = local.storage_account[each.key].acl[acl.key].access_policy[access_policy.key].start
213-
expiry = local.storage_account[each.key].acl[acl.key].access_policy[access_policy.key].expiry
213+
permissions = local.storage_share[each.key].acl[acl.key].access_policy[access_policy.key].permissions
214+
start = local.storage_share[each.key].acl[acl.key].access_policy[access_policy.key].start
215+
expiry = local.storage_share[each.key].acl[acl.key].access_policy[access_policy.key].expiry
214216
}
215217
}
216218
}

variables.tf

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,13 @@ locals {
8585
tags = {}
8686
}
8787
storage_share = {
88-
name = ""
89-
metadata = {}
90-
quota = "50"
91-
acl = {
92-
permissions = "rl"
93-
start = ""
94-
expiry = ""
95-
}
96-
tags = {}
88+
name = ""
89+
metadata = {}
90+
access_tier = "Hot"
91+
enabled_protocol = null
92+
quota = "50"
93+
acl = {}
94+
tags = {}
9795
}
9896
storage_share_directory = {
9997
name = ""

versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ terraform {
22
required_providers {
33
azurerm = {
44
source = "registry.terraform.io/hashicorp/azurerm"
5-
version = ">=3.5"
5+
version = ">=3.6"
66
}
77
}
88
required_version = ">=1.1"

0 commit comments

Comments
 (0)