-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathmain.tf
99 lines (83 loc) · 2.11 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
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
terraform {
required_providers {
databricks = {
source = "databrickslabs/databricks"
version = "0.2.5"
}
azurerm = {
version = "2.29.0"
}
}
}
provider "azurerm" {
features {}
}
provider "databricks" {
azure_workspace_resource_id = azurerm_databricks_workspace.myworkspace.id
}
resource "azurerm_resource_group" "myresourcegroup" {
name = "${var.prefix}-myresourcegroup"
location = var.location
}
resource "azurerm_databricks_workspace" "myworkspace" {
location = azurerm_resource_group.myresourcegroup.location
name = "${var.prefix}-workspace"
resource_group_name = azurerm_resource_group.myresourcegroup.name
sku = "trial"
}
resource "databricks_scim_user" "admin" {
user_name = "[email protected]"
display_name = "Admin user"
set_admin = true
default_roles = []
}
resource "databricks_cluster" "shared_autoscaling" {
cluster_name = "${var.prefix}-Autoscaling-Cluster"
spark_version = var.spark_version
node_type_id = var.node_type_id
autotermination_minutes = 90
autoscale {
min_workers = var.min_workers
max_workers = var.max_workers
}
library {
pypi {
package = "scikit-learn==0.23.2"
// repo can also be specified here
}
}
library {
pypi {
package = "fbprophet==0.6"
}
}
custom_tags = {
Department = "Engineering"
}
}
resource "databricks_notebook" "notebook" {
content = base64encode("print('Welcome to your Python notebook')")
path = var.notebook_path
overwrite = false
mkdirs = true
language = "PYTHON"
format = "SOURCE"
}
resource "databricks_job" "myjob" {
name = "Featurization"
timeout_seconds = 3600
max_retries = 1
max_concurrent_runs = 1
existing_cluster_id = databricks_cluster.shared_autoscaling.id
notebook_task {
notebook_path = var.notebook_path
}
library {
pypi {
package = "fbprophet==0.6"
}
}
email_notifications {
no_alert_for_skipped_runs = true
}
}