-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.tf
More file actions
131 lines (98 loc) · 4.81 KB
/
main.tf
File metadata and controls
131 lines (98 loc) · 4.81 KB
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
resource "azurerm_storage_account" "storage_account" {
name = var.name
resource_group_name = var.resource_group_name
location = var.location
account_replication_type = var.account_replication_type
account_tier = var.account_tier
public_network_access_enabled = var.public_network_access_enabled
tags = var.tags
blob_properties {
delete_retention_policy {
days = var.blob_properties_delete_retention_policy
}
versioning_enabled = var.blob_properties_versioning_enabled
}
lifecycle {
ignore_changes = [tags]
}
}
resource "azurerm_storage_container" "container" {
for_each = var.containers
name = each.value.container_name
storage_account_id = azurerm_storage_account.storage_account.id
container_access_type = each.value.container_access_type
}
resource "azurerm_storage_queue" "queue" {
for_each = var.queues != null ? toset(var.queues) : toset([])
name = each.value
storage_account_name = azurerm_storage_account.storage_account.name
}
/* --------------------------------------------------------------------------------------------------
Private Endpoint Configuration
-------------------------------------------------------------------------------------------------- */
module "private_endpoint_blob_storage" {
count = can(var.private_endpoint_properties.private_endpoint_enabled) ? 1 : 0
source = "../private-endpoint"
name = "${var.name}-blob-private-endpoint"
resource_group_name = var.private_endpoint_properties.private_endpoint_resource_group_name
location = var.location
subnet_id = var.private_endpoint_properties.private_endpoint_subnet_id
private_dns_zone_group = {
name = "${var.name}-blob-private-endpoint-zone-group"
private_dns_zone_ids = var.private_endpoint_properties.private_dns_zone_ids_blob
}
private_service_connection = {
name = "${var.name}-blob-private-endpoint-connection"
private_connection_resource_id = azurerm_storage_account.storage_account.id
subresource_names = ["blob"]
is_manual_connection = var.private_endpoint_properties.private_service_connection_is_manual
}
tags = var.tags
}
module "private_endpoint_table_storage" {
count = can(var.private_endpoint_properties.private_endpoint_enabled && var.private_endpoint_properties.private_dns_zone_ids_table != []) ? 1 : 0
source = "../private-endpoint"
name = "${var.name}-table-private-endpoint"
resource_group_name = var.private_endpoint_properties.private_endpoint_resource_group_name
location = var.location
subnet_id = var.private_endpoint_properties.private_endpoint_subnet_id
private_dns_zone_group = {
name = "${var.name}-table-private-endpoint-zone-group"
private_dns_zone_ids = var.private_endpoint_properties.private_dns_zone_ids_table
}
private_service_connection = {
name = "${var.name}-table-private-endpoint-connection"
private_connection_resource_id = azurerm_storage_account.storage_account.id
subresource_names = ["table"]
is_manual_connection = var.private_endpoint_properties.private_service_connection_is_manual
}
tags = var.tags
}
module "private_endpoint_queue_storage" {
count = can(var.private_endpoint_properties.private_endpoint_enabled) ? 1 : 0
source = "../private-endpoint"
name = "${var.name}-queue-private-endpoint"
resource_group_name = var.private_endpoint_properties.private_endpoint_resource_group_name
location = var.location
subnet_id = var.private_endpoint_properties.private_endpoint_subnet_id
private_dns_zone_group = {
name = "${var.name}-queue-private-endpoint-zone-group"
private_dns_zone_ids = var.private_endpoint_properties.private_dns_zone_ids_queue
}
private_service_connection = {
name = "${var.name}-queue-private-endpoint-connection"
private_connection_resource_id = azurerm_storage_account.storage_account.id
subresource_names = ["queue"]
is_manual_connection = var.private_endpoint_properties.private_service_connection_is_manual
}
tags = var.tags
}
module "diagnostic-settings" {
for_each = var.storage_account_service
source = "../diagnostic-settings"
name = "${var.name}-diagnotic-setting-storage"
target_resource_id = "${azurerm_storage_account.storage_account.id}/${each.value}/default"
log_analytics_workspace_id = var.log_analytics_workspace_id
enabled_log = var.monitor_diagnostic_setting_storage_account_enabled_logs
metric = var.monitor_diagnostic_setting_storage_account_metrics
}