-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
main.tf
71 lines (60 loc) · 2.44 KB
/
main.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
provider "azurerm" {
version = "=2.3.0"
features {}
}
variable BASE_NAME {}
variable RESOURCE_GROUP {}
variable WORKSPACE_NAME {}
#--------------------------------------------------------------------------------
#Set the already-existing resource group
data "azurerm_resource_group" "amlrg" {
name = var.RESOURCE_GROUP
}
#Set client config for a.o. tenant id
data "azurerm_client_config" "currentconfig" {
}
#--------------------------------------------------------------------------------
# Storage account for AML Service
resource "azurerm_storage_account" "amlstor" {
name = "${var.BASE_NAME}amlsa"
location = data.azurerm_resource_group.amlrg.location
resource_group_name = data.azurerm_resource_group.amlrg.name
account_tier = "Standard"
account_replication_type = "LRS"
}
# Keyvault for AML Service
resource "azurerm_key_vault" "amlkv" {
name = "${var.BASE_NAME}-AML-KV"
location = data.azurerm_resource_group.amlrg.location
resource_group_name = data.azurerm_resource_group.amlrg.name
tenant_id = data.azurerm_client_config.currentconfig.tenant_id
sku_name = "standard"
}
# App Insights for AML Service
resource "azurerm_application_insights" "amlai" {
name = "${var.BASE_NAME}-AML-AI"
location = data.azurerm_resource_group.amlrg.location
resource_group_name = data.azurerm_resource_group.amlrg.name
application_type = "web"
}
# Container registry for AML Service
resource "azurerm_container_registry" "amlacr" {
name = "${var.BASE_NAME}amlcr"
resource_group_name = data.azurerm_resource_group.amlrg.name
location = data.azurerm_resource_group.amlrg.location
sku = "Standard"
admin_enabled = true
}
# ML Workspace for AML Service, depending on the storage account, Keyvault, App Insights and ACR.
resource "azurerm_machine_learning_workspace" "amlws" {
name = var.WORKSPACE_NAME
location = data.azurerm_resource_group.amlrg.location
resource_group_name = data.azurerm_resource_group.amlrg.name
application_insights_id = azurerm_application_insights.amlai.id
key_vault_id = azurerm_key_vault.amlkv.id
storage_account_id = azurerm_storage_account.amlstor.id
container_registry_id = azurerm_container_registry.amlacr.id
identity {
type = "SystemAssigned"
}
}