Azure Databricks Terraform module — parameterised, azurerm 4.x, CI-validated.
This Terraform module creates an Azure Databricks workspace with enterprise-grade security features, VNet injection, cluster management, job orchestration, and SQL warehouses.
- Databricks Workspace: Premium SKU with managed resource group
- VNet Injection: Secure deployment within customer VNet
- Customer-Managed Keys: Encryption with Azure Key Vault
- Private Endpoints: Secure access without public IP
- Interactive Clusters: Configurable Spark clusters for development
- Job Clusters: Dedicated clusters for ETL workloads
- Job Orchestration: Multi-task jobs with dependencies
- SQL Warehouses: Serverless SQL analytics
- Cluster Policies: Governance and cost control
- Azure Policy Integration: Compliance and security policies
- Comprehensive Monitoring: Diagnostic settings and logging
Pin the module to a release tag:
module "databricks" {
source = "git::https://github.com/AIRCLOUD-PL/azure-databricks-module.git?ref=v1.0.0"
# required inputs
environment = "..."
location = "..."
resource_group_name = "..."
}All inputs and outputs are listed in the generated reference below (Inputs, Outputs). Worked examples live in examples/.
module "databricks" {
source = "git::https://github.com/AIRCLOUD-PL/azure-databricks-module.git?ref=v1.0.0"
resource_group_name = "rg-databricks"
location = "westeurope"
environment = "prod"
sku = "premium"
tags = {
Environment = "prod"
Project = "data-platform"
}
}module "databricks" {
source = "git::https://github.com/AIRCLOUD-PL/azure-databricks-module.git?ref=v1.0.0"
resource_group_name = "rg-databricks"
location = "westeurope"
environment = "prod"
# VNet injection
no_public_ip = true
virtual_network_id = azurerm_virtual_network.vnet.id
private_subnet_name = "snet-databricks-private"
public_subnet_name = "snet-databricks-public"
# Customer-managed key
customer_managed_key = {
key_vault_key_id = azurerm_key_vault_key.databricks.id
}
# Storage account for DBFS
storage_account_name = azurerm_storage_account.dbfs.name
# Security settings
public_network_access_enabled = false
# Interactive clusters
interactive_clusters = {
"data-eng-cluster" = {
spark_version = "13.3.x-scala2.12"
node_type_id = "Standard_DS3_v2"
num_workers = 4
autotermination_minutes = 120
spark_conf = {
"spark.databricks.delta.preview.enabled" = "true"
"spark.sql.adaptive.enabled" = "true"
}
custom_tags = {
"Team" = "Data Engineering"
"CostCenter" = "DE-001"
}
}
}
# Job clusters
job_clusters = {
"etl-cluster" = {
spark_version = "13.3.x-scala2.12"
node_type_id = "Standard_DS3_v2"
num_workers = 2
autotermination_minutes = 60
}
}
# ETL jobs
jobs = {
"daily-etl" = {
job_cluster = {
job_cluster_key = "etl-cluster"
spark_version = "13.3.x-scala2.12"
node_type_id = "Standard_DS3_v2"
num_workers = 2
}
tasks = [
{
task_key = "extract"
notebook_task = {
notebook_path = "/Shared/ETL/extract"
base_parameters = {
"source_path" = "/data/input"
}
}
},
{
task_key = "transform"
depends_on = [{ task_key = "extract" }]
notebook_task = {
notebook_path = "/Shared/ETL/transform"
}
},
{
task_key = "load"
depends_on = [{ task_key = "transform" }]
notebook_task = {
notebook_path = "/Shared/ETL/load"
}
}
]
schedule = {
quartz_cron_expression = "0 0 6 * * ?" # Daily at 6 AM
}
email_notifications = {
on_failure = ["data-team@company.com"]
}
tags = {
"team" = "data-engineering"
"priority" = "high"
}
}
}
# SQL warehouses
sql_warehouses = {
"analytics-warehouse" = {
cluster_size = "Medium"
auto_stop_mins = 60
tags = {
"team" = "analytics"
}
}
}
# Private endpoints
private_endpoints = {
databricks = {
subnet_id = azurerm_subnet.private.id
}
}
tags = {
Environment = "prod"
Project = "data-platform"
Owner = "Data Platform Team"
}
}- VNet Injection: Deploy Databricks within your virtual network
- Private Endpoints: Secure access without public exposure
- Customer-Managed Keys: Control encryption keys in Azure Key Vault
- Infrastructure Encryption: Double encryption for sensitive data
- Network Security: NSG associations and subnet delegations
- Azure Policy: Compliance and governance policies
The module includes comprehensive diagnostic settings for:
- Databricks workspace activity
- Cluster operations
- Job executions
- SQL warehouse usage
- Security events and audit logs
The module includes comprehensive Terratest coverage:
cd test
go test -v -run TestDatabricksModuleTests cover:
- Basic workspace creation
- VNet injection configuration
- Job orchestration
- Private endpoint setup
- Naming convention validation
- SQL warehouse creation
- Follow the established patterns for variable naming and resource configuration
- Include comprehensive test coverage for new features
- Update documentation for any new inputs or outputs
- Ensure compliance with enterprise security requirements
| Name | Version |
|---|---|
| terraform | >= 1.5.0 |
| azurerm | ~> 4.0 |
| databricks | ~> 1.0 |
| Name | Version |
|---|---|
| azurerm | 4.81.0 |
| databricks.workspace | 1.145.0 |
No modules.
| Name | Type |
|---|---|
| azurerm_databricks_workspace.main | resource |
| azurerm_private_endpoint.databricks | resource |
| azurerm_resource_group_policy_assignment.databricks_diagnostic_settings | resource |
| azurerm_resource_group_policy_assignment.databricks_encryption | resource |
| azurerm_resource_group_policy_assignment.databricks_public_access | resource |
| azurerm_resource_group_policy_assignment.databricks_vnet_injection | resource |
| databricks_cluster.interactive_clusters | resource |
| databricks_cluster.job_clusters | resource |
| databricks_cluster_policy.policies | resource |
| databricks_job.jobs | resource |
| databricks_notebook.notebooks | resource |
| databricks_permissions.cluster_permissions | resource |
| databricks_permissions.job_permissions | resource |
| databricks_sql_endpoint.warehouses | resource |
| azurerm_resource_group.main | data source |
| Name | Description | Type | Default | Required |
|---|---|---|---|---|
| cluster_permissions | Cluster permissions configuration | map(object({ |
{} |
no |
| cluster_policies | Cluster policies configuration | map(object({ |
{} |
no |
| customer_managed_key | Customer managed key configuration | object({ |
null |
no |
| databricks_workspace_name | Name of the Databricks workspace. If null, will be auto-generated. | string |
null |
no |
| enable_policy_assignments | Enable Azure Policy assignments for this Databricks workspace | bool |
true |
no |
| environment | Environment name (e.g., prod, dev, test) | string |
n/a | yes |
| infrastructure_encryption_enabled | Enable infrastructure encryption | bool |
true |
no |
| interactive_clusters | Interactive clusters configuration | map(object({ |
{} |
no |
| job_clusters | Job clusters configuration | map(object({ |
{} |
no |
| job_permissions | Job permissions configuration | map(object({ |
{} |
no |
| jobs | Jobs configuration | map(object({ |
{} |
no |
| location | Azure region where resources will be created | string |
n/a | yes |
| managed_resource_group_name | Name of the managed resource group | string |
null |
no |
| naming_prefix | Prefix for Databricks naming | string |
"databricks" |
no |
| no_public_ip | Disable public IP for Databricks workspace | bool |
true |
no |
| notebooks | Notebooks configuration | map(object({ |
{} |
no |
| private_endpoints | Private endpoint configurations | object({ |
{} |
no |
| private_subnet_name | Private subnet name for Databricks | string |
null |
no |
| private_subnet_network_security_group_association_id | Private subnet NSG association ID | string |
null |
no |
| public_network_access_enabled | Enable public network access | bool |
false |
no |
| public_subnet_name | Public subnet name for Databricks | string |
null |
no |
| public_subnet_network_security_group_association_id | Public subnet NSG association ID | string |
null |
no |
| resource_group_name | Name of the resource group | string |
n/a | yes |
| sku | Databricks workspace SKU | string |
"premium" |
no |
| sql_warehouses | SQL warehouses configuration | map(object({ |
{} |
no |
| storage_account_name | Storage account name for Databricks | string |
null |
no |
| storage_account_sku_name | Storage account SKU name | string |
"Standard_GRS" |
no |
| tags | Tags to apply to all resources | map(string) |
{} |
no |
| virtual_network_id | Virtual network ID for VNet injection | string |
null |
no |
| Name | Description |
|---|---|
| cluster_permissions | Cluster permissions |
| databricks_managed_resource_group_id | Managed resource group ID |
| databricks_managed_resource_group_name | Managed resource group name |
| databricks_storage_account_name | Storage account name for the Databricks workspace (deprecated in 4.x) |
| databricks_workspace_id | Databricks workspace ID |
| databricks_workspace_name | Databricks workspace name |
| databricks_workspace_url | Databricks workspace URL |
| interactive_clusters | Interactive clusters |
| job_clusters | Job clusters |
| job_permissions | Job permissions |
| jobs | Jobs |
| notebooks | Notebooks |
| private_endpoint_databricks_id | Databricks private endpoint ID |
| sql_warehouses | SQL warehouses |
Browse all modules with usage snippets in the module catalog or on github.com/AIRCLOUD-PL. Built and maintained by AIRCLOUD: DevOps, cloud and AI engineering. Need a hand with Azure landing zones or platform engineering? See aircloud.com.pl/consulting.
