Skip to content

Commit db513b6

Browse files
authored
Update adb-with-private-links-standard to use azurerm v4 (#157)
Signed-off-by: Niko <[email protected]>
1 parent 9fa5dc0 commit db513b6

File tree

11 files changed

+48
-12
lines changed

11 files changed

+48
-12
lines changed

examples/adb-with-private-link-standard/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,7 @@ This example can be used to deploy the following:
2424
2. (Optional) Configure your [remote backend](https://developer.hashicorp.com/terraform/language/settings/backends/azurerm)
2525
3. Run `terraform init` to initialize terraform and get provider ready.
2626
4. Run `terraform apply` to create the resources.
27+
28+
## How to test
29+
30+
Public access to the workspace deployed here is not allowed by default. If you can establish a direct network connection to the VNet into which the workspace is deployed then you should be able to browse the workspace directly. Alternatively, a virtual machine is created as part of this deployment allowing you to connect to the workspace in case you don't have direct network path to the VNet in which the workspace is deployed. You can use the `test_vm_public_ip` and `test_vm_password` to log into this VM (password value is marked as `sensitive` but can be found in the `teraform.tfstate` file). By default, access to this machine is only allowed from the deployer's public IP address. To allow access from other sources, extra rules can be added to the Network Security Group created for the VM as part of this deployment.

examples/adb-with-private-link-standard/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module "adb-with-private-link-standard" {
2-
source = "github.com/databricks/terraform-databricks-examples/modules/adb-with-private-link-standard"
2+
source = "../../modules/adb-with-private-link-standard"
33
cidr_transit = var.cidr_transit
44
cidr_dp = var.cidr_dp
55
location = var.location

examples/adb-with-private-link-standard/outputs.tf

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,19 @@ output "test_vm_password" {
22
description = "Password to access the Test VM, use `terraform output -json test_vm_password` to get the password value"
33
value = module.adb-with-private-link-standard.test_vm_password
44
sensitive = true
5+
}
6+
7+
output "test_vm_public_ip" {
8+
description = "Public IP of the Azure VM created for testing"
9+
value = module.adb-with-private-link-standard.test_vm_public_ip
10+
}
11+
12+
output "workspace_id" {
13+
description = "The Databricks workspace ID"
14+
value = module.adb-with-private-link-standard.workspace_id
15+
}
16+
17+
output "workspace_url" {
18+
description = "The Databricks workspace URL"
19+
value = module.adb-with-private-link-standard.workspace_url
520
}

examples/adb-with-private-link-standard/versions.tf renamed to examples/adb-with-private-link-standard/providers.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ terraform {
22
required_providers {
33
azurerm = {
44
source = "hashicorp/azurerm"
5-
version = "~>3.104.0"
5+
version = ">=4.0.0"
66
}
77
}
88
}
99

1010
provider "azurerm" {
11+
subscription_id = var.subscription_id
1112
features {}
1213
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
subscription_id = "<your Azure Subscription ID here>"
12
cidr_transit = "10.178.0.0/20"
23
cidr_dp = "10.179.0.0/20"
34
location = "westeurope"

examples/adb-with-private-link-standard/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
variable "subscription_id" {
2+
type = string
3+
description = "Azure Subscription ID to deploy the workspace into"
4+
}
5+
16
variable "cidr_transit" {
27
type = string
38
description = "(Required) The CIDR for the Azure transit VNet"

modules/adb-with-private-link-standard/databricks_workspace.tf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ resource "azurerm_databricks_workspace" "dp_workspace" {
99
network_security_group_rules_required = "NoAzureDatabricksRules"
1010
customer_managed_key_enabled = true
1111
custom_parameters {
12-
no_public_ip = true
1312
virtual_network_id = azurerm_virtual_network.dp_vnet.id
1413
private_subnet_name = azurerm_subnet.dp_private.name
1514
public_subnet_name = azurerm_subnet.dp_public.name

modules/adb-with-private-link-standard/main.tf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ data "external" "me" {
1212
}
1313

1414
locals {
15-
// dltp - databricks labs terraform provider
1615
prefix = join("-", ["tfdemo", "${random_string.naming.result}"])
1716
dbfsname = join("", ["dbfs", "${random_string.naming.result}"]) // dbfs name must not have special chars
1817

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,30 @@
11
output "dp_databricks_azure_workspace_resource_id" {
2-
description = "The ID of the Databricks Workspace in the Azure management plane."
2+
description = "**Depricated** The ID of the Databricks Workspace in the Azure management plane."
33
value = azurerm_databricks_workspace.dp_workspace.id
44
}
55

66
output "dp_workspace_url" {
77
value = "https://${azurerm_databricks_workspace.dp_workspace.workspace_url}/"
8-
description = "The workspace URL which is of the format 'adb-{workspaceId}.{random}.azuredatabricks.net'"
8+
description = "**Depricated** Renamed to `workspace_url` to align with naming used in other modules"
9+
}
10+
11+
output "test_vm_public_ip" {
12+
value = azurerm_public_ip.testvmpublicip.ip_address
13+
description = "Public IP of the created virtual machine"
914
}
1015

1116
output "test_vm_password" {
1217
description = "Password to access the Test VM, use `terraform output -json test_vm_password` to get the password value"
1318
value = azurerm_windows_virtual_machine.testvm.admin_password
1419
sensitive = true
1520
}
21+
22+
output "workspace_url" {
23+
value = "https://${azurerm_databricks_workspace.dp_workspace.workspace_url}/"
24+
description = "The workspace URL which is of the format 'adb-{workspaceId}.{random}.azuredatabricks.net'"
25+
}
26+
27+
output "workspace_id" {
28+
description = "The Databricks workspace ID"
29+
value = azurerm_databricks_workspace.dp_workspace.workspace_id
30+
}

modules/adb-with-private-link-standard/versions.tf renamed to modules/adb-with-private-link-standard/providers.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ terraform {
22
required_providers {
33
azurerm = {
44
source = "hashicorp/azurerm"
5-
version = ">= 3.104.0"
5+
version = ">=4.0.0"
66
}
77
}
88
}

0 commit comments

Comments
 (0)