-
Notifications
You must be signed in to change notification settings - Fork 138
/
Copy pathmain.tf
45 lines (38 loc) · 1.5 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
resource "random_string" "naming" {
special = false
upper = false
length = 6
}
data "azurerm_client_config" "current" {
}
data "external" "me" {
program = ["az", "account", "show", "--query", "user"]
}
# Retrieve information about the current user (the caller of tf apply)
data "databricks_current_user" "me" {
depends_on = [azurerm_databricks_workspace.this]
}
data "databricks_spark_version" "latest_lts" {
long_term_support = true
latest = true
depends_on = [azurerm_databricks_workspace.this]
}
locals {
prefix = join("-", [var.workspace_prefix, "${random_string.naming.result}"])
location = var.rglocation
cidr = var.spokecidr
sqlcidr = var.sqlvnetcidr
dbfsname = join("", [var.dbfs_prefix, "${random_string.naming.result}"]) // dbfs name must not have special chars
db_url = "jdbc:sqlserver://${azurerm_mssql_server.metastoreserver.name}.database.windows.net:1433;database=${azurerm_mssql_database.sqlmetastore.name};user=${var.db_username}@${azurerm_mssql_server.metastoreserver.name};password={${var.db_password}};encrypt=true;trustServerCertificate=false;hostNameInCertificate=*.database.windows.net;loginTimeout=30;"
my_username = lookup(data.external.me.result, "name")
tags = {
Environment = "Testing"
Owner = local.my_username
Epoch = random_string.naming.result
}
}
resource "azurerm_resource_group" "this" {
name = "adb-test-${local.prefix}-rg"
location = local.location
tags = local.tags
}