Skip to content

Commit a63c95e

Browse files
authored
Improve modules - descriptions & types for variables (#106)
Also reformatted code
1 parent ed27c28 commit a63c95e

File tree

46 files changed

+418
-210
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+418
-210
lines changed

Diff for: examples/adb-exfiltration-protection/variables.tf

+17-17
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,64 @@
11
variable "hubcidr" {
22
description = "IP range for creaiton of the Spoke VNet"
3-
type = string
4-
default = "10.178.0.0/20"
3+
type = string
4+
default = "10.178.0.0/20"
55
}
66

77
variable "spokecidr" {
88
description = "IP range for creaiton of the Hub VNet"
9-
type = string
10-
default = "10.179.0.0/20"
9+
type = string
10+
default = "10.179.0.0/20"
1111
}
1212

1313
variable "no_public_ip" {
1414
description = "If workspace should be created with No-Public-IP"
15-
type = bool
16-
default = true
15+
type = bool
16+
default = true
1717
}
1818

1919
variable "rglocation" {
2020
description = "Location of resource group"
21-
type = string
21+
type = string
2222
}
2323

2424
variable "metastore" {
2525
description = "List of FQDNs for Azure Databricks Metastore databases"
26-
type = list(string)
26+
type = list(string)
2727
}
2828

2929
variable "scc_relay" {
3030
description = "List of FQDNs for Azure Databricks Secure Cluster Connectivity relay"
31-
type = list(string)
31+
type = list(string)
3232
}
3333

3434
variable "webapp_ips" {
3535
description = "List of IP ranges for Azure Databricks Webapp"
36-
type = list(string)
36+
type = list(string)
3737
}
3838

3939
variable "extended_infra_ip" {
4040
description = "IP range for Azure Databricks extended infrastructure"
41-
type = string
41+
type = string
4242
}
4343

4444
variable "eventhubs" {
4545
description = "List of FQDNs for Azure Databricks EventHubs traffic"
46-
type = list(string)
46+
type = list(string)
4747
}
4848

4949
variable "dbfs_prefix" {
5050
description = "Prefix for DBFS storage account name"
51-
type = string
52-
default = "dbfs"
51+
type = string
52+
default = "dbfs"
5353
}
5454

5555
variable "workspace_prefix" {
5656
description = "Prefix for workspace name"
57-
type = string
58-
default = "adb"
57+
type = string
58+
default = "adb"
5959
}
6060

6161
variable "firewallfqdn" {
62-
type = list(any)
62+
type = list(any)
6363
description = "List of domains names to put into application rules for handling of HTTPS traffic (Databricks storage accounts, etc.)"
6464
}

Diff for: examples/adb-external-hive-metastore/main.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ data "external" "me" {
2222

2323
# Retrieve information about the current user (the caller of tf apply)
2424
data "databricks_current_user" "me" {
25-
depends_on = [azurerm_databricks_workspace.this]
25+
depends_on = [azurerm_databricks_workspace.this]
2626
}
2727

2828
data "databricks_spark_version" "latest_lts" {

Diff for: examples/adb-lakehouse/main.tf

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ module "adb-lakehouse-uc-metastore" {
2828
metastore_id = module.adb-lakehouse-uc-metastore.metastore_id
2929
workspace_id = module.adb-lakehouse.workspace_id
3030
metastore_admins = var.metastore_admins
31-
providers = {
31+
providers = {
3232
databricks = databricks.workspace
3333
}
3434
}
@@ -39,7 +39,7 @@ module "adb-lakehouse-uc-account-principals" {
3939
workspace_id = module.adb-lakehouse.workspace_id
4040
service_principals = var.service_principals
4141
account_groups = var.account_groups
42-
providers = {
42+
providers = {
4343
databricks = databricks.account
4444
}
4545
}
@@ -55,7 +55,7 @@ module "adb-lakehouse-data-assets" {
5555
landing_adls_path = var.landing_adls_path
5656
landing_adls_rg = var.landing_adls_rg
5757
metastore_admins = var.metastore_admins
58-
providers = {
58+
providers = {
5959
databricks = databricks.workspace
6060
}
6161
}

Diff for: examples/adb-unity-catalog-basic-demo/main.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ resource "databricks_grants" "silver" {
204204
}
205205
}
206206

207-
// Create schema for gold datalake layer in dev env.
207+
// Create schema for gold datalake layer in dev env.
208208
resource "databricks_schema" "gold" {
209209
catalog_name = databricks_catalog.dev.id
210210
name = "gold"

Diff for: examples/adb-with-private-link-standard/outputs.tf

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
output "test_vm_password" {
22
description = "Password to access the Test VM, use `terraform output -json test_vm_password` to get the password value"
3-
value = module.adb-with-private-link-standard.test_vm_password
4-
sensitive = true
3+
value = module.adb-with-private-link-standard.test_vm_password
4+
sensitive = true
55
}

Diff for: examples/aws-databricks-modular-privatelink/variables.tf

+8-4
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@ variable "databricks_account_password" {
77
}
88

99
variable "databricks_account_id" {
10-
type = string
10+
type = string
11+
description = "Databricks Account ID"
1112
}
1213

1314
variable "region" {
14-
type = string
15-
default = "ap-southeast-1"
15+
type = string
16+
description = "AWS region to deploy to"
17+
default = "ap-southeast-1"
1618
}
1719

1820
#cmk
@@ -22,7 +24,9 @@ variable "cmk_admin" {
2224
}
2325

2426
variable "tags" {
25-
default = {}
27+
default = {}
28+
type = map(string)
29+
description = "Optional tags to add to created resources"
2630
}
2731

2832
variable "vpc_cidr" {

Diff for: examples/aws-databricks-uc-bootstrap/variables.tf

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ variable "databricks_account_password" {
77
}
88

99
variable "databricks_account_id" {
10-
type = string
10+
type = string
11+
description = "Databricks Account ID"
1112
}
1213

1314
variable "databricks_users" {

Diff for: examples/aws-databricks-uc/variables.tf

+8-4
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,20 @@ variable "databricks_account_password" {
77
}
88

99
variable "databricks_account_id" {
10-
type = string
10+
type = string
11+
description = "Databricks Account ID"
1112
}
1213

1314
variable "region" {
14-
type = string
15-
default = "ap-southeast-1"
15+
type = string
16+
description = "AWS region to deploy to"
17+
default = "ap-southeast-1"
1618
}
1719

1820
variable "tags" {
19-
default = {}
21+
default = {}
22+
type = map(string)
23+
description = "Optional tags to add to created resources"
2024
}
2125

2226
variable "databricks_workspace_ids" {

Diff for: examples/aws-exfiltration-protection/main.tf

+7-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,10 @@ module "aws-exfiltration-protection" {
33
databricks_account_id = var.databricks_account_id
44
databricks_account_username = var.databricks_account_username
55
databricks_account_password = var.databricks_account_password
6-
}
6+
}
7+
8+
resource "random_string" "naming" {
9+
special = false
10+
upper = false
11+
length = 6
12+
}

Diff for: examples/aws-exfiltration-protection/variables.tf

+38-17
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,67 @@
11
variable "databricks_account_username" {}
22
variable "databricks_account_password" {}
3-
variable "databricks_account_id" {}
3+
4+
variable "databricks_account_id" {
5+
type = string
6+
description = "Databricks Account ID"
7+
}
48

59
variable "tags" {
6-
default = {}
10+
default = {}
11+
type = map(string)
12+
description = "Optional tags to add to created resources"
713
}
814

915
variable "spoke_cidr_block" {
10-
default = "10.173.0.0/16"
16+
default = "10.173.0.0/16"
17+
description = "IP range for spoke AWS VPC"
18+
type = string
1119
}
20+
1221
variable "hub_cidr_block" {
13-
default = "10.10.0.0/16"
22+
default = "10.10.0.0/16"
23+
description = "IP range for hub AWS VPC"
24+
type = string
1425
}
26+
1527
variable "region" {
16-
default = "eu-central-1"
28+
default = "eu-central-1"
29+
type = string
30+
description = "AWS region to deploy to"
1731
}
1832

19-
resource "random_string" "naming" {
20-
special = false
21-
upper = false
22-
length = 6
23-
}
2433
variable "whitelisted_urls" {
25-
default = [".pypi.org", ".pythonhosted.org", ".cran.r-project.org"]
34+
default = [".pypi.org", ".pythonhosted.org", ".cran.r-project.org"]
35+
description = "List of the domains to allow traffic to"
36+
type = list(string)
2637
}
2738

2839
variable "db_web_app" {
29-
default = "frankfurt.cloud.databricks.com"
40+
default = "frankfurt.cloud.databricks.com"
41+
description = "Hostname of Databricks web application"
42+
type = string
3043
}
3144

3245
variable "db_tunnel" {
33-
default = "tunnel.eu-central-1.cloud.databricks.com"
46+
default = "tunnel.eu-central-1.cloud.databricks.com"
47+
description = "Hostname of Databricks SCC Relay"
48+
type = string
3449
}
3550

3651
variable "db_rds" {
37-
default = "mdv2llxgl8lou0.ceptxxgorjrc.eu-central-1.rds.amazonaws.com"
52+
default = "mdv2llxgl8lou0.ceptxxgorjrc.eu-central-1.rds.amazonaws.com"
53+
description = "Hostname of AWS RDS instance for built-in Hive Metastore"
54+
type = string
3855
}
3956

4057
variable "db_control_plane" {
41-
default = "18.159.44.32/28"
58+
default = "18.159.44.32/28"
59+
description = "IP Range for AWS Databricks control plane"
60+
type = string
4261
}
4362

4463
variable "prefix" {
45-
default = "demo"
46-
}
64+
default = "demo"
65+
type = string
66+
description = "Prefix for use in the generated names"
67+
}

Diff for: examples/aws-remote-backend-infra/main.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ terraform {
1313
}
1414

1515
resource "aws_s3_bucket" "terraform_state" {
16-
bucket = var.bucket_name
16+
bucket = var.bucket_name
1717
force_destroy = true
1818
}
1919

Diff for: examples/aws-workspace-basic/main.tf

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
module "aws-workspace-basic" {
2-
source = "github.com/databricks/terraform-databricks-examples/modules/aws-workspace-basic"
3-
databricks_account_id = var.databricks_account_id
2+
source = "github.com/databricks/terraform-databricks-examples/modules/aws-workspace-basic"
3+
databricks_account_id = var.databricks_account_id
44
}

Diff for: examples/aws-workspace-basic/variables.tf

+14-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
1-
variable "databricks_account_id" {}
1+
variable "databricks_account_id" {
2+
type = string
3+
description = "Databricks Account ID"
4+
}
25

36
variable "tags" {
4-
default = {}
7+
default = {}
8+
type = map(string)
9+
description = "Optional tags to add to created resources"
510
}
611

712
variable "cidr_block" {
8-
default = "10.4.0.0/16"
13+
description = "IP range for AWS VPC"
14+
type = string
15+
default = "10.4.0.0/16"
916
}
1017

1118
variable "region" {
12-
default = "eu-west-1"
13-
}
19+
default = "eu-west-1"
20+
type = string
21+
description = "AWS region to deploy to"
22+
}

Diff for: examples/aws-workspace-basic/versions.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ provider "aws" {
1818
}
1919

2020
provider "databricks" {
21-
host = "https://accounts.cloud.databricks.com"
21+
host = "https://accounts.cloud.databricks.com"
2222
}

Diff for: examples/aws-workspace-uc-simple/init.tf

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
data "aws_caller_identity" "current" {}
2+
3+
locals {
4+
prefix = "demo-${random_string.naming.result}"
5+
unity_admin_group = "${local.prefix}-${var.unity_admin_group}"
6+
workspace_users_group = "${local.prefix}-workspace-users"
7+
aws_access_services_role_name = var.aws_access_services_role_name == null ? "${local.prefix}-aws-services-role" : "${local.prefix}-${var.aws_access_services_role_name}"
8+
aws_access_services_role_arn = "arn:aws:iam::${local.aws_account_id}:role/${local.aws_access_services_role_name}"
9+
aws_account_id = data.aws_caller_identity.current.account_id
10+
tags = merge(var.tags, { Owner = split("@", var.my_username)[0], ownerEmail = var.my_username })
11+
}
12+
13+
resource "random_string" "naming" {
14+
special = false
15+
upper = false
16+
length = 6
17+
}

Diff for: examples/aws-workspace-uc-simple/main.tf

-1
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,4 @@ module "unity_catalog" {
4444
unity_metastore_owner = databricks_group.admin_group.display_name
4545
databricks_workspace_ids = [module.databricks_workspace.databricks_workspace_id]
4646
tags = local.tags
47-
4847
}

0 commit comments

Comments
 (0)