From 632e32a73f42700485243115042a6d8eed0d9924 Mon Sep 17 00:00:00 2001 From: Chris Stephens Date: Fri, 12 Jun 2026 12:29:35 -0700 Subject: [PATCH 1/2] acc: Prevent lifecycle-started-terraform-error from leaking a started warehouse This test deploys a bundle with lifecycle.started: true on the terraform engine and expects plan/deploy to fail with a validation error. The script had no teardown: it relied entirely on the deploy failing before resource creation. If that error path regresses (or the failure moves to mid-apply, after the warehouse is created), every run leaks a started Medium SQL warehouse with a 2h auto-stop into the shared cloud test workspace. Leaked warehouses like this contributed to a GCP local-SSD quota exhaustion that took down CI. Defuse the test in two ways: - Add a cleanup trap that always runs 'bundle destroy --auto-approve' on exit (the idiom used by the sibling lifecycle-started tests), so any accidentally created warehouse is torn down even when the script fails. bundle destroy does not run PreDeployChecks, so it is not blocked by the same lifecycle.started validation error. - Shrink the warehouse to 2X-Small with auto_stop_mins: 10 so that even a transient leak is as cheap and short-lived as possible. The test only exercises the validation error path, so the size is irrelevant to intent. Expected output regenerated with -update (error location moved to line 17; destroy reports no active deployment in the happy path). Co-authored-by: Isaac --- .../lifecycle-started-terraform-error/databricks.yml.tmpl | 6 +++++- .../lifecycle-started-terraform-error/output.txt | 7 +++++-- .../lifecycle-started-terraform-error/script | 8 ++++++++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/acceptance/bundle/resources/sql_warehouses/lifecycle-started-terraform-error/databricks.yml.tmpl b/acceptance/bundle/resources/sql_warehouses/lifecycle-started-terraform-error/databricks.yml.tmpl index cad38109b8e..71be1591054 100644 --- a/acceptance/bundle/resources/sql_warehouses/lifecycle-started-terraform-error/databricks.yml.tmpl +++ b/acceptance/bundle/resources/sql_warehouses/lifecycle-started-terraform-error/databricks.yml.tmpl @@ -8,6 +8,10 @@ resources: sql_warehouses: mywarehouse: name: my-warehouse-$UNIQUE_NAME - cluster_size: "Medium" + # Smallest size and shortest auto-stop: this test only verifies the + # error path, so if a warehouse is ever created by mistake it should + # be as cheap and short-lived as possible. + cluster_size: "2X-Small" + auto_stop_mins: 10 lifecycle: started: true diff --git a/acceptance/bundle/resources/sql_warehouses/lifecycle-started-terraform-error/output.txt b/acceptance/bundle/resources/sql_warehouses/lifecycle-started-terraform-error/output.txt index 67d9a86b663..cf79cfead34 100644 --- a/acceptance/bundle/resources/sql_warehouses/lifecycle-started-terraform-error/output.txt +++ b/acceptance/bundle/resources/sql_warehouses/lifecycle-started-terraform-error/output.txt @@ -2,7 +2,7 @@ === bundle plan fails with lifecycle.started on terraform engine >>> errcode [CLI] bundle plan Error: lifecycle.started is only supported in direct deployment mode - in databricks.yml:13:18 + in databricks.yml:17:18 Exit code: 1 @@ -10,7 +10,10 @@ Exit code: 1 === bundle deploy fails with lifecycle.started on terraform engine >>> errcode [CLI] bundle deploy Error: lifecycle.started is only supported in direct deployment mode - in databricks.yml:13:18 + in databricks.yml:17:18 Exit code: 1 + +>>> [CLI] bundle destroy --auto-approve +No active deployment found to destroy! diff --git a/acceptance/bundle/resources/sql_warehouses/lifecycle-started-terraform-error/script b/acceptance/bundle/resources/sql_warehouses/lifecycle-started-terraform-error/script index 4fb2038cd28..9e66f5361b8 100644 --- a/acceptance/bundle/resources/sql_warehouses/lifecycle-started-terraform-error/script +++ b/acceptance/bundle/resources/sql_warehouses/lifecycle-started-terraform-error/script @@ -1,5 +1,13 @@ envsubst < databricks.yml.tmpl > databricks.yml +# The plan/deploy commands below are expected to fail before any resource is +# created. Always destroy on exit so that a regression in that error path can +# never leak a running warehouse into the shared cloud workspace. +cleanup() { + trace $CLI bundle destroy --auto-approve +} +trap cleanup EXIT + title "bundle plan fails with lifecycle.started on terraform engine" trace errcode $CLI bundle plan From 03b39b1a81566e96a11a2a70d55d9855ca1b9788 Mon Sep 17 00:00:00 2001 From: Chris Stephens Date: Fri, 12 Jun 2026 13:07:26 -0700 Subject: [PATCH 2/2] acc: Remove redundant comments Match the comment-free cleanup idiom of the sibling lifecycle-started tests; regenerate expected output for the shifted error location. Co-authored-by: Isaac --- .../lifecycle-started-terraform-error/databricks.yml.tmpl | 3 --- .../lifecycle-started-terraform-error/output.txt | 4 ++-- .../sql_warehouses/lifecycle-started-terraform-error/script | 3 --- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/acceptance/bundle/resources/sql_warehouses/lifecycle-started-terraform-error/databricks.yml.tmpl b/acceptance/bundle/resources/sql_warehouses/lifecycle-started-terraform-error/databricks.yml.tmpl index 71be1591054..bd8387d47e5 100644 --- a/acceptance/bundle/resources/sql_warehouses/lifecycle-started-terraform-error/databricks.yml.tmpl +++ b/acceptance/bundle/resources/sql_warehouses/lifecycle-started-terraform-error/databricks.yml.tmpl @@ -8,9 +8,6 @@ resources: sql_warehouses: mywarehouse: name: my-warehouse-$UNIQUE_NAME - # Smallest size and shortest auto-stop: this test only verifies the - # error path, so if a warehouse is ever created by mistake it should - # be as cheap and short-lived as possible. cluster_size: "2X-Small" auto_stop_mins: 10 lifecycle: diff --git a/acceptance/bundle/resources/sql_warehouses/lifecycle-started-terraform-error/output.txt b/acceptance/bundle/resources/sql_warehouses/lifecycle-started-terraform-error/output.txt index cf79cfead34..cbf77bae970 100644 --- a/acceptance/bundle/resources/sql_warehouses/lifecycle-started-terraform-error/output.txt +++ b/acceptance/bundle/resources/sql_warehouses/lifecycle-started-terraform-error/output.txt @@ -2,7 +2,7 @@ === bundle plan fails with lifecycle.started on terraform engine >>> errcode [CLI] bundle plan Error: lifecycle.started is only supported in direct deployment mode - in databricks.yml:17:18 + in databricks.yml:14:18 Exit code: 1 @@ -10,7 +10,7 @@ Exit code: 1 === bundle deploy fails with lifecycle.started on terraform engine >>> errcode [CLI] bundle deploy Error: lifecycle.started is only supported in direct deployment mode - in databricks.yml:17:18 + in databricks.yml:14:18 Exit code: 1 diff --git a/acceptance/bundle/resources/sql_warehouses/lifecycle-started-terraform-error/script b/acceptance/bundle/resources/sql_warehouses/lifecycle-started-terraform-error/script index 9e66f5361b8..2fa20eecb7b 100644 --- a/acceptance/bundle/resources/sql_warehouses/lifecycle-started-terraform-error/script +++ b/acceptance/bundle/resources/sql_warehouses/lifecycle-started-terraform-error/script @@ -1,8 +1,5 @@ envsubst < databricks.yml.tmpl > databricks.yml -# The plan/deploy commands below are expected to fail before any resource is -# created. Always destroy on exit so that a regression in that error path can -# never leak a running warehouse into the shared cloud workspace. cleanup() { trace $CLI bundle destroy --auto-approve }