|
| 1 | +# Terraform Template - Azure Databricks (Workspace) |
| 2 | + |
| 3 | +Costa Rica |
| 4 | + |
| 5 | +[](https://github.com/) |
| 6 | +[brown9804](https://github.com/brown9804) |
| 7 | + |
| 8 | +Last updated: 2026-02-12 |
| 9 | + |
| 10 | +------------------------------------------ |
| 11 | + |
| 12 | +> This template contains Terraform configurations to create an Azure Databricks workspace. |
| 13 | +
|
| 14 | +> [!IMPORTANT] |
| 15 | +> |
| 16 | +> - Azure Databricks creates a **managed resource group** for service-managed infrastructure. You will typically see **two resource groups**: your main RG plus the Databricks-managed RG. This is expected behavior. |
| 17 | +> - If you disable `append_random_suffix`, you may hit name collisions. |
| 18 | +
|
| 19 | +<div align="center"> |
| 20 | + <img width="650" alt="image" src="https://github.com/user-attachments/assets/5f4cf7a6-9317-4d34-adcf-c493297ab814" style="border: 2px solid #4CAF50; border-radius: 5px; padding: 5px;"/> |
| 21 | +</div> |
| 22 | + |
| 23 | +<div align="center"> |
| 24 | + <img width="650" alt="image" src="https://github.com/user-attachments/assets/90778a82-a56f-4b56-8673-66339073c746" style="border: 2px solid #4CAF50; border-radius: 5px; padding: 5px;"/> |
| 25 | +</div> |
| 26 | + |
| 27 | +<div align="center"> |
| 28 | + <img width="650" alt="image" src="https://github.com/user-attachments/assets/eb7c2c5c-2f1b-4bb1-8266-5e3093f28371" style="border: 2px solid #4CAF50; border-radius: 5px; padding: 5px;"/> |
| 29 | +</div> |
| 30 | + |
| 31 | +## File Descriptions |
| 32 | + |
| 33 | +- **main.tf**: Creates/updates the Resource Group (idempotent ARM PUT) and the Databricks workspace. |
| 34 | +- **variables.tf**: Defines input variables used in the Terraform configuration. |
| 35 | +- **provider.tf**: Configures the AzureRM + AzAPI + Random providers. |
| 36 | +- **terraform.tfvars**: Example values for variables. |
| 37 | +- **outputs.tf**: Outputs such as the workspace ID and URL. |
| 38 | + |
| 39 | +## Variables |
| 40 | + |
| 41 | +| Variable Name | Description | Type | Example Value | |
| 42 | +| --- | --- | --- | --- | |
| 43 | +| `resource_group_name` | Resource Group name to deploy into (created if missing). | string | `"rg-analytics-dev"` | |
| 44 | +| `location` | Azure region for the deployment. | string | `"eastus"` | |
| 45 | +| `databricks_workspace_name` | Base workspace name. If suffix enabled, final is `<base>-<suffix>`. | string | `"dbw-analytics-dev"` | |
| 46 | +| `sku` | Workspace SKU (`standard`, `premium`, `trial`). | string | `"standard"` | |
| 47 | +| `managed_resource_group_name` | Optional base managed RG name. If omitted, Databricks auto-generates it. | string | `null` | |
| 48 | +| `append_random_suffix` | Append random suffix to reduce name collisions. | bool | `true` | |
| 49 | +| `random_suffix_length` | Length of the suffix when enabled. | number | `6` | |
| 50 | +| `tags` | Tags applied to resources. | map(string) | `{ "env": "dev" }` | |
| 51 | + |
| 52 | +## Usage |
| 53 | + |
| 54 | +1. Authenticate: |
| 55 | + |
| 56 | + ```sh |
| 57 | + az login |
| 58 | + az account show |
| 59 | + # If needed: |
| 60 | + az account set --subscription "<subscription-id-or-name>" |
| 61 | + ``` |
| 62 | + |
| 63 | +2. Initialize: |
| 64 | + |
| 65 | + ```sh |
| 66 | + terraform init -upgrade |
| 67 | + ``` |
| 68 | + |
| 69 | +3. Validate and plan: |
| 70 | + |
| 71 | + ```sh |
| 72 | + terraform validate |
| 73 | + terraform plan |
| 74 | + ``` |
| 75 | + |
| 76 | +4. Apply: |
| 77 | + |
| 78 | + ```sh |
| 79 | + terraform apply -auto-approve |
| 80 | + ``` |
| 81 | + |
| 82 | +<!-- START BADGE --> |
| 83 | +<div align="center"> |
| 84 | + <img src="https://img.shields.io/badge/Total%20views-1790-limegreen" alt="Total views"> |
| 85 | + <p>Refresh Date: 2026-02-12</p> |
| 86 | +</div> |
| 87 | +<!-- END BADGE --> |
0 commit comments