Skip to content

Commit 0763c45

Browse files
authored
Update adb-kafka to use azurerm v4 (#152)
Signed-off-by: Niko <[email protected]>
1 parent ce8367e commit 0763c45

File tree

10 files changed

+127
-86
lines changed

10 files changed

+127
-86
lines changed

examples/adb-kafka/.terraform.lock.hcl

+85-65
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/adb-kafka/data.tf

+4
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,7 @@ data "azurerm_client_config" "current" {
44
data "external" "me" {
55
program = ["az", "account", "show", "--query", "user"]
66
}
7+
8+
data "http" "ipinfo" {
9+
url = "https://ipinfo.io"
10+
}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
output "vm_public_ip" {
2-
value = azurerm_public_ip.general-nic-pubip.ip_address
2+
description = "Public IP of the VM"
3+
value = azurerm_public_ip.general-nic-pubip.ip_address
34
}

examples/adb-kafka/modules/general_vm/providers.tf

-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,3 @@ terraform {
55
}
66
}
77
}
8-
9-
provider "azurerm" {
10-
features {}
11-
}

examples/adb-kafka/outputs.tf

+17-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
11
output "pip" {
2-
value = module.kafka_broker.vm_public_ip
2+
description = "Public IP of the Kafka broker"
3+
value = module.kafka_broker.vm_public_ip
4+
}
5+
6+
output "azure_resource_group_id" {
7+
description = "The Azure resource group ID"
8+
value = azurerm_resource_group.this.id
9+
}
10+
11+
output "workspace_id" {
12+
description = "The Databricks workspace ID"
13+
value = azurerm_databricks_workspace.this.workspace_id
14+
}
15+
16+
output "workspace_url" {
17+
description = "The Databricks workspace URL"
18+
value = "https://${azurerm_databricks_workspace.this.workspace_url}/"
319
}

examples/adb-kafka/providers.tf

+10-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
terraform {
22
required_providers {
33
azurerm = {
4-
source = "hashicorp/azurerm"
4+
source = "hashicorp/azurerm"
5+
version = ">=4.0.0"
6+
}
7+
random = {
8+
source = "hashicorp/random"
9+
}
10+
http = {
11+
source = "hashicorp/http"
512
}
613
}
714
}
815

916
provider "azurerm" {
17+
subscription_id = var.subscription_id
1018
features {}
11-
}
12-
13-
provider "random" {
14-
}
19+
}

examples/adb-kafka/terraform.tfvars

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
subscription_id = "<your Azure Subscription ID here>"
12
spokecidr = "10.179.0.0/20"
2-
no_public_ip = true
33
rglocation = "southeastasia"
44
dbfs_prefix = "dbfs"
55
workspace_prefix = "adb-kafka"

examples/adb-kafka/variables.tf

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
variable "spokecidr" {
2-
type = string
1+
variable "subscription_id" {
2+
type = string
3+
description = "Azure Subscription ID to deploy the workspace into"
34
}
45

5-
variable "no_public_ip" {
6-
type = bool
6+
variable "spokecidr" {
7+
type = string
78
}
89

910
variable "rglocation" {

examples/adb-kafka/vnet.tf

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ resource "azurerm_network_security_group" "vmnsg" {
1919
protocol = "Tcp"
2020
source_port_range = "*"
2121
destination_port_range = "22"
22-
source_address_prefix = "*"
22+
source_address_prefix = format("%s/32", jsondecode(data.http.ipinfo.response_body).ip)
2323
destination_address_prefix = "*"
2424
}
2525
}
@@ -73,7 +73,7 @@ resource "azurerm_subnet" "private" {
7373
virtual_network_name = azurerm_virtual_network.this.name
7474
address_prefixes = [cidrsubnet(var.cidr, 3, 1)]
7575

76-
private_endpoint_network_policies_enabled = true
76+
private_endpoint_network_policies = "Enabled"
7777
private_link_service_network_policies_enabled = true
7878

7979
delegation {

examples/adb-kafka/workspace.tf

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ resource "azurerm_databricks_workspace" "this" {
55
sku = "premium"
66
tags = local.tags
77
customer_managed_key_enabled = true
8-
//infrastructure_encryption_enabled = true
98
custom_parameters {
10-
no_public_ip = var.no_public_ip
119
virtual_network_id = azurerm_virtual_network.this.id
1210
private_subnet_name = azurerm_subnet.private.name
1311
public_subnet_name = azurerm_subnet.public.name
@@ -20,4 +18,4 @@ resource "azurerm_databricks_workspace" "this" {
2018
azurerm_subnet_network_security_group_association.public,
2119
azurerm_subnet_network_security_group_association.private
2220
]
23-
}
21+
}

0 commit comments

Comments
 (0)