Skip to content

Update adb-kafka to use azurerm v4 #152

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
150 changes: 85 additions & 65 deletions examples/adb-kafka/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions examples/adb-kafka/data.tf
Original file line number Diff line number Diff line change
@@ -4,3 +4,7 @@ data "azurerm_client_config" "current" {
data "external" "me" {
program = ["az", "account", "show", "--query", "user"]
}

data "http" "ipinfo" {
url = "https://ipinfo.io"
}
3 changes: 2 additions & 1 deletion examples/adb-kafka/modules/general_vm/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
output "vm_public_ip" {
value = azurerm_public_ip.general-nic-pubip.ip_address
description = "Public IP of the VM"
value = azurerm_public_ip.general-nic-pubip.ip_address
}
4 changes: 0 additions & 4 deletions examples/adb-kafka/modules/general_vm/providers.tf
Original file line number Diff line number Diff line change
@@ -5,7 +5,3 @@ terraform {
}
}
}

provider "azurerm" {
features {}
}
18 changes: 17 additions & 1 deletion examples/adb-kafka/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
output "pip" {
value = module.kafka_broker.vm_public_ip
description = "Public IP of the Kafka broker"
value = module.kafka_broker.vm_public_ip
}

output "azure_resource_group_id" {
description = "The Azure resource group ID"
value = azurerm_resource_group.this.id
}

output "workspace_id" {
description = "The Databricks workspace ID"
value = azurerm_databricks_workspace.this.workspace_id
}

output "workspace_url" {
description = "The Databricks workspace URL"
value = "https://${azurerm_databricks_workspace.this.workspace_url}/"
}
15 changes: 10 additions & 5 deletions examples/adb-kafka/providers.tf
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
source = "hashicorp/azurerm"
version = ">=4.0.0"
}
random = {
source = "hashicorp/random"
}
http = {
source = "hashicorp/http"
}
}
}

provider "azurerm" {
subscription_id = var.subscription_id
features {}
}

provider "random" {
}
}
2 changes: 1 addition & 1 deletion examples/adb-kafka/terraform.tfvars
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
subscription_id = "<your Azure Subscription ID here>"
spokecidr = "10.179.0.0/20"
no_public_ip = true
rglocation = "southeastasia"
dbfs_prefix = "dbfs"
workspace_prefix = "adb-kafka"
9 changes: 5 additions & 4 deletions examples/adb-kafka/variables.tf
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
variable "spokecidr" {
type = string
variable "subscription_id" {
type = string
description = "Azure Subscription ID to deploy the workspace into"
}

variable "no_public_ip" {
type = bool
variable "spokecidr" {
type = string
}

variable "rglocation" {
4 changes: 2 additions & 2 deletions examples/adb-kafka/vnet.tf
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ resource "azurerm_network_security_group" "vmnsg" {
protocol = "Tcp"
source_port_range = "*"
destination_port_range = "22"
source_address_prefix = "*"
source_address_prefix = format("%s/32", jsondecode(data.http.ipinfo.response_body).ip)
destination_address_prefix = "*"
}
}
@@ -73,7 +73,7 @@ resource "azurerm_subnet" "private" {
virtual_network_name = azurerm_virtual_network.this.name
address_prefixes = [cidrsubnet(var.cidr, 3, 1)]

private_endpoint_network_policies_enabled = true
private_endpoint_network_policies = "Enabled"
private_link_service_network_policies_enabled = true

delegation {
4 changes: 1 addition & 3 deletions examples/adb-kafka/workspace.tf
Original file line number Diff line number Diff line change
@@ -5,9 +5,7 @@ resource "azurerm_databricks_workspace" "this" {
sku = "premium"
tags = local.tags
customer_managed_key_enabled = true
//infrastructure_encryption_enabled = true
custom_parameters {
no_public_ip = var.no_public_ip
virtual_network_id = azurerm_virtual_network.this.id
private_subnet_name = azurerm_subnet.private.name
public_subnet_name = azurerm_subnet.public.name
@@ -20,4 +18,4 @@ resource "azurerm_databricks_workspace" "this" {
azurerm_subnet_network_security_group_association.public,
azurerm_subnet_network_security_group_association.private
]
}
}