-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.tf
More file actions
155 lines (118 loc) · 4.37 KB
/
main.tf
File metadata and controls
155 lines (118 loc) · 4.37 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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
// Tags
locals {
tags = {
owner = var.tag_department
region = var.tag_region
environment = var.environment
}
}
// Existing Resources
/// Subscription ID
data "azurerm_subscription" "current" {
}
// Random Suffix Generator
resource "random_integer" "deployment_id_suffix" {
min = 100
max = 999
}
// Resource Group
resource "azurerm_resource_group" "rg" {
name = "${var.class_name}-${var.student_name}-${var.environment}-${random_integer.deployment_id_suffix.result}-rg"
location = var.location
tags = local.tags
}
// Storage Account
resource "azurerm_storage_account" "storage" {
name = "${var.class_name}${var.student_name}${var.environment}${random_integer.deployment_id_suffix.result}st"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
account_tier = "Standard"
account_replication_type = "LRS"
tags = local.tags
}
/////////////////////////////////////////////////////////////CosmosDB
resource "random_integer" "ri" {
min = 10000
max = 99999
}
resource "azurerm_cosmosdb_account" "db" {
name = "tfex-cosmos-db-${random_integer.ri.result}"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
offer_type = "Standard"
kind = "MongoDB"
enable_automatic_failover = true
capabilities {
name = "EnableAggregationPipeline"
}
capabilities {
name = "mongoEnableDocLevelTTL"
}
capabilities {
name = "MongoDBv3.4"
}
capabilities {
name = "EnableMongo"
}
consistency_policy {
consistency_level = "BoundedStaleness"
max_interval_in_seconds = 300
max_staleness_prefix = 100000
}
geo_location {
location = "eastus"
failover_priority = 1
}
geo_location {
location = "westus"
failover_priority = 0
}
}
/////////////////////////////////////////////////// azure ml
data "azurerm_client_config" "current" {}
resource "azurerm_application_insights" "ai" {
name = "${var.class_name}-${var.student_name}-${var.environment}-${random_integer.deployment_id_suffix.result}-ai"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
application_type = "web"
}
resource "azurerm_key_vault" "kv" {
name = "${var.class_name}-${var.student_name}-${random_integer.deployment_id_suffix.result}-kv"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
tenant_id = data.azurerm_client_config.current.tenant_id
sku_name = "premium"
}
resource "azurerm_machine_learning_workspace" "mlw" {
name = "${var.class_name}-${var.student_name}-${var.environment}-${random_integer.deployment_id_suffix.result}-mlw"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
application_insights_id = azurerm_application_insights.ai.id
key_vault_id = azurerm_key_vault.kv.id
storage_account_id = azurerm_storage_account.storage.id
identity {
type = "SystemAssigned"
}
}
/////////////////////////////////////// alexa
resource "azurerm_bot_channels_registration" "bcr" {
name = "${var.class_name}-${var.student_name}-${var.environment}-${random_integer.deployment_id_suffix.result}-bcr"
location = "global"
resource_group_name = azurerm_resource_group.rg.name
sku = "F0"
microsoft_app_id = data.azurerm_client_config.current.client_id
}
resource "azurerm_bot_channel_alexa" "bca" {
bot_name = azurerm_bot_channels_registration.bcr.name
location = azurerm_bot_channels_registration.bcr.location
resource_group_name = azurerm_resource_group.rg.name
skill_id = "${random_integer.deployment_id_suffix.result}-amzn1.ask.skill.00000000-0000-0000-0000-000000000000"
}
/////////////////////////////////////////// Power Bi
resource "azurerm_powerbi_embedded" "powerbi" {
name = "${var.class_name}${var.student_name}powerbi"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
sku_name = "A1"
administrators = ["rchan5@uncc.edu"]
}