Skip to content

Commit c1afa53

Browse files
authored
Merge pull request #7 from data-platform-hq/feat/lakebase_instance
feat: added lakebase instance
2 parents cc49d5c + b3eeeb4 commit c1afa53

File tree

4 files changed

+34
-3
lines changed

4 files changed

+34
-3
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,13 +354,13 @@ module "databricks_runtime" {
354354
| Name | Version |
355355
|------|---------|
356356
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >=1.3 |
357-
| <a name="requirement_databricks"></a> [databricks](#requirement\_databricks) | ~>1.0 |
357+
| <a name="requirement_databricks"></a> [databricks](#requirement\_databricks) | >=1.85.0 |
358358

359359
## Providers
360360

361361
| Name | Version |
362362
|------|---------|
363-
| <a name="provider_databricks"></a> [databricks](#provider\_databricks) | ~>1.0 |
363+
| <a name="provider_databricks"></a> [databricks](#provider\_databricks) | >=1.85.0 |
364364

365365
## Modules
366366

@@ -373,6 +373,7 @@ No modules.
373373
| [databricks_cluster.this](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/cluster) | resource |
374374
| [databricks_cluster_policy.overrides](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/cluster_policy) | resource |
375375
| [databricks_cluster_policy.this](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/cluster_policy) | resource |
376+
| [databricks_database_instance.this](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/database_instance) | resource |
376377
| [databricks_entitlements.this](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/entitlements) | resource |
377378
| [databricks_group.this](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/group) | resource |
378379
| [databricks_ip_access_list.allowed_list](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/ip_access_list) | resource |
@@ -406,6 +407,7 @@ No modules.
406407
| <a name="input_iam_workspace_groups"></a> [iam\_workspace\_groups](#input\_iam\_workspace\_groups) | Used to create workspace group. Map of group name and its parameters, such as users and service principals added to the group. Also possible to configure group entitlements. | <pre>map(object({<br/> user = optional(list(string))<br/> service_principal = optional(list(string))<br/> entitlements = optional(list(string))<br/> }))</pre> | `{}` | no |
407408
| <a name="input_ip_addresses"></a> [ip\_addresses](#input\_ip\_addresses) | A map of IP address ranges | `map(string)` | <pre>{<br/> "all": "0.0.0.0/0"<br/>}</pre> | no |
408409
| <a name="input_key_vault_secret_scope"></a> [key\_vault\_secret\_scope](#input\_key\_vault\_secret\_scope) | Object with Azure Key Vault parameters required for creation of Azure-backed Databricks Secret scope | <pre>list(object({<br/> name = string<br/> key_vault_id = string<br/> dns_name = string<br/> tenant_id = string<br/> }))</pre> | `[]` | no |
410+
| <a name="input_lakebase_instance"></a> [lakebase\_instance](#input\_lakebase\_instance) | Map of objects with parameters to configure and deploy OLTP database instances in Databricks.<br/>To deploy and use an OLTP database instance in Databricks:<br/>- You must be a Databricks workspace owner.<br/>- A Databricks workspace must already be deployed in your cloud environment (e.g., AWS or Azure).<br/>- The workspace must be on the Premium plan or above.<br/>- You must enable the "Lakebase: Managed Postgres OLTP Database" feature in the Preview features section.<br/>- Database instances can only be deleted manually through the Databricks UI or using the Databricks CLI with the --purge option. | <pre>map(object({<br/> name = string<br/> capacity = optional(string, "CU_1")<br/> node_count = optional(number, 1)<br/> enable_readable_secondaries = optional(bool, false)<br/> retention_window_in_days = optional(number, 7)<br/> }))</pre> | `{}` | no |
409411
| <a name="input_mount_configuration"></a> [mount\_configuration](#input\_mount\_configuration) | Configuration for mounting storage, including only service principal details | <pre>object({<br/> service_principal = object({<br/> client_id = string<br/> client_secret = string<br/> tenant_id = string<br/> })<br/> })</pre> | <pre>{<br/> "service_principal": {<br/> "client_id": null,<br/> "client_secret": null,<br/> "tenant_id": null<br/> }<br/>}</pre> | no |
410412
| <a name="input_mount_enabled"></a> [mount\_enabled](#input\_mount\_enabled) | Boolean flag that determines whether mount point for storage account filesystem is created | `bool` | `false` | no |
411413
| <a name="input_mountpoints"></a> [mountpoints](#input\_mountpoints) | Mountpoints for databricks | <pre>map(object({<br/> storage_account_name = string<br/> container_name = string<br/> }))</pre> | `{}` | no |

lakebase.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
resource "databricks_database_instance" "this" {
2+
for_each = var.lakebase_instance
3+
4+
name = each.value.name
5+
capacity = each.value.capacity
6+
node_count = each.value.node_count
7+
enable_readable_secondaries = each.value.enable_readable_secondaries
8+
retention_window_in_days = each.value.retention_window_in_days
9+
}

variables.tf

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,3 +272,23 @@ variable "ip_addresses" {
272272
"all" = "0.0.0.0/0"
273273
}
274274
}
275+
276+
variable "lakebase_instance" {
277+
type = map(object({
278+
name = string
279+
capacity = optional(string, "CU_1")
280+
node_count = optional(number, 1)
281+
enable_readable_secondaries = optional(bool, false)
282+
retention_window_in_days = optional(number, 7)
283+
}))
284+
default = {}
285+
description = <<DESCRIPTION
286+
Map of objects with parameters to configure and deploy OLTP database instances in Databricks.
287+
To deploy and use an OLTP database instance in Databricks:
288+
- You must be a Databricks workspace owner.
289+
- A Databricks workspace must already be deployed in your cloud environment (e.g., AWS or Azure).
290+
- The workspace must be on the Premium plan or above.
291+
- You must enable the "Lakebase: Managed Postgres OLTP Database" feature in the Preview features section.
292+
- Database instances can only be deleted manually through the Databricks UI or using the Databricks CLI with the --purge option.
293+
DESCRIPTION
294+
}

versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
databricks = {
66
source = "databricks/databricks"
7-
version = "~>1.0"
7+
version = ">=1.85.0"
88
}
99
}
1010
}

0 commit comments

Comments
 (0)