-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvariables.tf
132 lines (129 loc) · 4.56 KB
/
variables.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
variable "storage_account" {
type = any
default = {}
description = "resource definition, default settings are defined within locals and merged with var settings"
}
variable "storage_container" {
type = any
default = {}
description = "resource definition, default settings are defined within locals and merged with var settings"
}
variable "storage_share" {
type = any
default = {}
description = "resource definition, default settings are defined within locals and merged with var settings"
}
variable "storage_share_directory" {
type = any
default = {}
description = "resource definition, default settings are defined within locals and merged with var settings"
}
locals {
default = {
# resource definition
storage_account = {
name = ""
account_kind = "StorageV2"
account_tier = "Standard"
account_replication_type = "ZRS"
cross_tenant_replication_enabled = false
access_tier = "Hot"
edge_zone = null
enable_https_traffic_only = true
min_tls_version = "TLS1_2"
allow_nested_items_to_be_public = false
shared_access_key_enabled = true
is_hns_enabled = null
nfsv3_enabled = false
large_file_share_enabled = null
queue_encryption_key_type = null
table_encryption_key_type = null
infrastructure_encryption_enabled = false
custom_domain = {
name = ""
use_subdomain = null
}
customer_managed_key = {}
identity = {
type = ""
identity_ids = null
}
blob_properties = {}
queue_properties = {}
static_website = {}
network_rules = {
default_action = ""
bypass = null
ip_rules = []
virtual_network_subnet_ids = []
private_link_access = {}
}
azure_files_authentication = {
directory_type = ""
active_directory = {}
}
routing = {}
tags = {}
}
storage_container = {
name = ""
container_access_type = "private"
tags = {}
}
storage_share = {
name = ""
metadata = {}
quota = "50"
acl = {
permissions = "rl"
start = ""
expiry = ""
}
tags = {}
}
storage_share_directory = {
name = ""
metadata = {}
tags = {}
}
}
# compare and merge custom and default values
storage_account_values = {
for storage_account in keys(var.storage_account) :
storage_account => merge(local.default.storage_account, var.storage_account[storage_account])
}
storage_share_values = {
for storage_share in keys(var.storage_share) :
storage_share => merge(local.default.storage_share, var.storage_share[storage_share])
}
# merge all custom and default values
storage_account = {
for storage_account in keys(var.storage_account) :
storage_account => merge(
local.storage_account_values[storage_account],
{
#for config in ["custom_domain", "customer_managed_key", "identity", "blob_properties", "queue_properties", "static_website", "network_rules", "azure_files_authentication", "routing", "queue_encryption_key_type", "table_encryption_key_type", "infrastructure_encryption_enabled"] :
for config in ["custom_domain", "customer_managed_key", "identity", "static_website", "azure_files_authentication", "routing", ] :
config => merge(local.default.storage_account[config], local.storage_account_values[storage_account][config])
}
)
}
storage_container = {
for storage_container in keys(var.storage_container) :
storage_container => merge(local.default.storage_container, var.storage_container[storage_container])
}
storage_share = {
for storage_share in keys(var.storage_share) :
storage_share => merge(
local.storage_share_values[storage_share],
{
for config in ["acl"] :
config => merge(local.default.storage_share[config], local.storage_share_values[storage_share][config])
}
)
}
storage_share_directory = {
for storage_share_directory in keys(var.storage_share_directory) :
storage_share_directory => merge(local.default.storage_share_directory, var.storage_share_directory[storage_share_directory])
}
}