-
Notifications
You must be signed in to change notification settings - Fork 121
Description
Describe the issue
When a databricks.yml file has a database instance and a database catalog referenciated and you try to perform a deployment on an already asset bundle deployed, bundle terraform fails because name is already deployed.
It is creating that, when you have a single bundle for an app with database, everytime you try to deploy new features, an error will appear unless you change the database_instance name
Configuration
databricks.yml
resources:
database_instances:
marketplace_instance:
name: ${var.instance_name}
capacity: ${var.capacity}
database_catalogs:
marketplace_catalog:
database_instance_name: ${resources.database_instances.marketplace_instance.name}
name: ${var.catalog_name}
database_name: ${var.database_name}
create_database_if_not_exists: true
apps:
marketplace_app:
name: ${var.app_name}
description: "Astellas Internal Data Marketplace - Discover, explore, and manage data products"
source_code_path: ${workspace.file_path}/src
resources:
- name: "marketplace_database"
database:
database_name: ${resources.database_catalogs.marketplace_catalog.database_name}
instance_name: ${resources.database_instances.marketplace_instance.name}
permission: "CAN_CONNECT_AND_CREATE"Steps to reproduce the behavior
Initial deploy
- Create a bundle project with an app and a database
- databricks bundle validate -> success
- databricks bundle deploy -> database and app are deployed
New feature development that needs to be deployed
- databricks bundle validate -> success
- databricks bundle deploy -> error
Error: terraform apply: exit status 1
Error: failed to create database_instance
with databricks_database_instance.marketplace_instance, on bundle.tf.json line 44, in resource.databricks_database_instance.marketplace_instance: 44: }
Instance name is not unique.Expected Behavior
You can bypass the creation of a database_instance if it is already existing.
If fails, deployment is rolled back
Actual Behavior
Code is deployed because step is done before the attempt of the creation of the database instance
OS and CLI version
databricks CLI v0.273.0
Python 3.12.10
Windows 11 Enterprise 10.0.26100 Build 26100
Is this a regression?
No
Debug Logs
Attached