-
Notifications
You must be signed in to change notification settings - Fork 0
/
blob-storage.tf
163 lines (130 loc) · 5.24 KB
/
blob-storage.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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
data "azurerm_resource_group" "darts_resource_group" {
name = format("%s-%s-rg", var.product, var.env)
}
data "azurerm_subnet" "private_endpoints" {
resource_group_name = local.private_endpoint_rg_name
virtual_network_name = local.private_endpoint_vnet_name
name = "private-endpoints"
}
module "sa" {
source = "[email protected]:hmcts/cnp-module-storage-account?ref=master"
env = var.env
storage_account_name = local.storage_account_name
common_tags = var.common_tags
default_action = "Allow"
resource_group_name = azurerm_resource_group.darts_resource_group.name
location = var.location
account_tier = var.sa_account_tier
account_kind = var.sa_account_kind
account_replication_type = var.sa_account_replication_type
access_tier = var.sa_access_tier
allow_nested_items_to_be_public = "true"
enable_change_feed = true
private_endpoint_subnet_id = data.azurerm_subnet.private_endpoints.id
enable_data_protection = true
containers = local.containers
cors_rules = [{
allowed_headers = ["*"]
allowed_methods = ["GET", "OPTIONS"]
allowed_origins = ["https://hmctsdartsb2csbox.b2clogin.com"]
exposed_headers = ["*"]
max_age_in_seconds = 200
}]
}
resource "azurerm_storage_blob" "outbound" {
name = "${var.product}-outbound-blob-st-${var.env}"
storage_account_name = module.sa.storageaccount_name
storage_container_name = local.darts_container_name
type = "Block"
depends_on = [module.sa]
}
resource "azurerm_storage_blob" "unstructured" {
name = "${var.product}-unstrcutured-blob-st-${var.env}"
storage_account_name = module.sa.storageaccount_name
storage_container_name = local.darts_container_name
type = "Block"
depends_on = [module.sa]
}
resource "azurerm_storage_blob" "inbound" {
name = "${var.product}-inbound-blob-st-${var.env}"
storage_account_name = module.sa.storageaccount_name
storage_container_name = local.darts_inbound_container
type = "Block"
depends_on = [module.sa]
}
resource "azurerm_storage_blob" "b2c_login_html" {
name = "login.html"
content_type = "text/html"
content_md5 = filemd5("./b2c/login.html")
storage_account_name = module.sa.storageaccount_name
storage_container_name = local.darts_container_name
type = "Block"
source = "./b2c/login.html"
depends_on = [module.sa]
}
resource "azurerm_storage_blob" "b2c_login_css" {
name = "login.css"
content_type = "text/css"
content_md5 = filemd5("./b2c/login.css")
storage_account_name = module.sa.storageaccount_name
storage_container_name = local.darts_container_name
type = "Block"
source = "./b2c/login.css"
depends_on = [module.sa]
}
resource "azurerm_storage_blob" "b2c_copyright_png" {
name = "copyright.png"
content_type = "image/x-png"
content_md5 = filemd5("./b2c/copyright.png")
storage_account_name = module.sa.storageaccount_name
storage_container_name = local.darts_container_name
type = "Block"
source = "./b2c/copyright.png"
depends_on = [module.sa]
}
resource "azurerm_storage_blob" "b2c_favicon" {
name = "favicon.ico"
content_type = "image/x-icon"
content_md5 = filemd5("./b2c/favicon.ico")
storage_account_name = module.sa.storageaccount_name
storage_container_name = local.darts_container_name
type = "Block"
source = "./b2c/favicon.ico"
depends_on = [module.sa]
}
resource "azurerm_storage_blob" "b2c_logo_gov" {
name = "logo_gov.png"
content_type = "image/x-png"
content_md5 = filemd5("./b2c/logo_gov.png")
storage_account_name = module.sa.storageaccount_name
storage_container_name = local.darts_container_name
type = "Block"
source = "./b2c/logo_gov.png"
depends_on = [module.sa]
}
resource "azurerm_storage_blob" "b2c_mfa_html" {
name = "mfa.html"
content_type = "text/html"
content_md5 = filemd5("./b2c/mfa.html")
storage_account_name = module.sa.storageaccount_name
storage_container_name = local.darts_container_name
type = "Block"
source = "./b2c/mfa.html"
depends_on = [module.sa]
}
resource "azurerm_storage_blob" "b2c_mfa_css" {
name = "mfa.css"
content_type = "text/css"
content_md5 = filemd5("./b2c/mfa.css")
storage_account_name = module.sa.storageaccount_name
storage_container_name = local.darts_container_name
type = "Block"
source = "./b2c/mfa.css"
depends_on = [module.sa]
}
resource "azurerm_role_assignment" "storage_contributors" {
for_each = toset(var.storage_account_contributor_ids)
scope = module.sa.storageaccount_id
role_definition_name = "Storage Account Contributor"
principal_id = each.value
}