From 0a2f264fe34d42d46d1dadf5800bed84be9d81ad Mon Sep 17 00:00:00 2001 From: Pieter Noordhuis Date: Tue, 21 Apr 2026 15:29:51 +0200 Subject: [PATCH 1/2] Prompt before destroying Lakebase resources Extend the deploy/destroy data-loss warning to cover four resource types that were added since the prompt was last updated: database_instances, synced_database_tables, postgres_projects, and postgres_branches. Deleting or recreating any of these can result in permanent data loss, so they now get the same confirmation treatment as schemas, pipelines, volumes, and dashboards. Co-authored-by: Isaac --- .../single-instance/output.txt | 4 ++ .../current_can_manage/output.txt | 4 ++ .../current_can_manage/output.txt | 4 ++ .../postgres_branches/basic/output.txt | 8 ++++ .../postgres_branches/recreate/output.txt | 12 ++++++ .../update_protected/output.txt | 8 ++++ .../postgres_endpoints/basic/output.txt | 8 ++++ .../postgres_endpoints/recreate/output.txt | 8 ++++ .../update_autoscaling/output.txt | 8 ++++ .../postgres_projects/basic/output.txt | 4 ++ .../postgres_projects/recreate/output.txt | 8 ++++ .../update_display_name/output.txt | 4 ++ .../synced_database_tables/basic/output.txt | 8 ++++ bundle/phases/deploy.go | 40 ++++++++++++++++++- bundle/phases/destroy.go | 36 +++++++++++++++++ bundle/phases/messages.go | 28 +++++++++++++ 16 files changed, 191 insertions(+), 1 deletion(-) diff --git a/acceptance/bundle/resources/database_instances/single-instance/output.txt b/acceptance/bundle/resources/database_instances/single-instance/output.txt index 8a08317172c..e6b8b506a71 100644 --- a/acceptance/bundle/resources/database_instances/single-instance/output.txt +++ b/acceptance/bundle/resources/database_instances/single-instance/output.txt @@ -59,6 +59,10 @@ Resources: The following resources will be deleted: delete resources.database_instances.my_database +This action will result in the deletion of the following Lakebase database instances. +All data stored in them will be permanently lost: + delete resources.database_instances.my_database + All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/deploy-lakebase-single-instance-[UNIQUE_NAME]/default Deleting files... diff --git a/acceptance/bundle/resources/permissions/database_instances/current_can_manage/output.txt b/acceptance/bundle/resources/permissions/database_instances/current_can_manage/output.txt index 092bc944ed2..87a9a4f993c 100644 --- a/acceptance/bundle/resources/permissions/database_instances/current_can_manage/output.txt +++ b/acceptance/bundle/resources/permissions/database_instances/current_can_manage/output.txt @@ -61,6 +61,10 @@ Warning: unknown field: instance_profile_arn The following resources will be deleted: delete resources.database_instances.foo +This action will result in the deletion of the following Lakebase database instances. +All data stored in them will be permanently lost: + delete resources.database_instances.foo + All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test-bundle/default Deleting files... diff --git a/acceptance/bundle/resources/permissions/postgres_projects/current_can_manage/output.txt b/acceptance/bundle/resources/permissions/postgres_projects/current_can_manage/output.txt index 10e8ce61d53..876d077e601 100644 --- a/acceptance/bundle/resources/permissions/postgres_projects/current_can_manage/output.txt +++ b/acceptance/bundle/resources/permissions/postgres_projects/current_can_manage/output.txt @@ -29,6 +29,10 @@ Deployment complete! The following resources will be deleted: delete resources.postgres_projects.foo +This action will result in the deletion of the following Lakebase projects along with +all their branches, databases, and endpoints. All data stored in them will be permanently lost: + delete resources.postgres_projects.foo + All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test-bundle/default Deleting files... diff --git a/acceptance/bundle/resources/postgres_branches/basic/output.txt b/acceptance/bundle/resources/postgres_branches/basic/output.txt index ae9053d377c..9da42b6da2a 100644 --- a/acceptance/bundle/resources/postgres_branches/basic/output.txt +++ b/acceptance/bundle/resources/postgres_branches/basic/output.txt @@ -69,6 +69,14 @@ The following resources will be deleted: delete resources.postgres_branches.main delete resources.postgres_projects.my_project +This action will result in the deletion of the following Lakebase projects along with +all their branches, databases, and endpoints. All data stored in them will be permanently lost: + delete resources.postgres_projects.my_project + +This action will result in the deletion of the following Lakebase branches. +All data stored in them will be permanently lost: + delete resources.postgres_branches.main + All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/deploy-postgres-branch-[UNIQUE_NAME]/default Deleting files... diff --git a/acceptance/bundle/resources/postgres_branches/recreate/output.txt b/acceptance/bundle/resources/postgres_branches/recreate/output.txt index fa929532591..bcc1528946b 100644 --- a/acceptance/bundle/resources/postgres_branches/recreate/output.txt +++ b/acceptance/bundle/resources/postgres_branches/recreate/output.txt @@ -64,6 +64,10 @@ resources: >>> [CLI] bundle deploy --auto-approve Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/deploy-postgres-branch-recreate-[UNIQUE_NAME]/default/files... + +This action will result in the deletion or recreation of the following Lakebase branches. +All data stored in them will be permanently lost: + recreate resources.postgres_branches.main Deploying resources... Updating deployment state... Deployment complete! @@ -75,6 +79,14 @@ The following resources will be deleted: delete resources.postgres_branches.main delete resources.postgres_projects.my_project +This action will result in the deletion of the following Lakebase projects along with +all their branches, databases, and endpoints. All data stored in them will be permanently lost: + delete resources.postgres_projects.my_project + +This action will result in the deletion of the following Lakebase branches. +All data stored in them will be permanently lost: + delete resources.postgres_branches.main + All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/deploy-postgres-branch-recreate-[UNIQUE_NAME]/default Deleting files... diff --git a/acceptance/bundle/resources/postgres_branches/update_protected/output.txt b/acceptance/bundle/resources/postgres_branches/update_protected/output.txt index b32d48a9093..7380da0adce 100644 --- a/acceptance/bundle/resources/postgres_branches/update_protected/output.txt +++ b/acceptance/bundle/resources/postgres_branches/update_protected/output.txt @@ -154,6 +154,14 @@ The following resources will be deleted: delete resources.postgres_branches.dev_branch delete resources.postgres_projects.my_project +This action will result in the deletion of the following Lakebase projects along with +all their branches, databases, and endpoints. All data stored in them will be permanently lost: + delete resources.postgres_projects.my_project + +This action will result in the deletion of the following Lakebase branches. +All data stored in them will be permanently lost: + delete resources.postgres_branches.dev_branch + All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/update-postgres-branch-[UNIQUE_NAME]/default Deleting files... diff --git a/acceptance/bundle/resources/postgres_endpoints/basic/output.txt b/acceptance/bundle/resources/postgres_endpoints/basic/output.txt index 53de63481dd..898cb54c465 100644 --- a/acceptance/bundle/resources/postgres_endpoints/basic/output.txt +++ b/acceptance/bundle/resources/postgres_endpoints/basic/output.txt @@ -87,6 +87,14 @@ The following resources will be deleted: delete resources.postgres_endpoints.custom delete resources.postgres_projects.my_project +This action will result in the deletion of the following Lakebase projects along with +all their branches, databases, and endpoints. All data stored in them will be permanently lost: + delete resources.postgres_projects.my_project + +This action will result in the deletion of the following Lakebase branches. +All data stored in them will be permanently lost: + delete resources.postgres_branches.main + All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/deploy-postgres-endpoint-[UNIQUE_NAME]/default Deleting files... diff --git a/acceptance/bundle/resources/postgres_endpoints/recreate/output.txt b/acceptance/bundle/resources/postgres_endpoints/recreate/output.txt index 9f9bb4faa8a..8b5725834e7 100644 --- a/acceptance/bundle/resources/postgres_endpoints/recreate/output.txt +++ b/acceptance/bundle/resources/postgres_endpoints/recreate/output.txt @@ -147,6 +147,14 @@ The following resources will be deleted: delete resources.postgres_endpoints.my_endpoint delete resources.postgres_projects.my_project +This action will result in the deletion of the following Lakebase projects along with +all their branches, databases, and endpoints. All data stored in them will be permanently lost: + delete resources.postgres_projects.my_project + +This action will result in the deletion of the following Lakebase branches. +All data stored in them will be permanently lost: + delete resources.postgres_branches.main + All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/deploy-postgres-endpoint-recreate-[UNIQUE_NAME]/default Deleting files... diff --git a/acceptance/bundle/resources/postgres_endpoints/update_autoscaling/output.txt b/acceptance/bundle/resources/postgres_endpoints/update_autoscaling/output.txt index a53bd840536..9192423fa68 100644 --- a/acceptance/bundle/resources/postgres_endpoints/update_autoscaling/output.txt +++ b/acceptance/bundle/resources/postgres_endpoints/update_autoscaling/output.txt @@ -187,6 +187,14 @@ The following resources will be deleted: delete resources.postgres_endpoints.my_endpoint delete resources.postgres_projects.my_project +This action will result in the deletion of the following Lakebase projects along with +all their branches, databases, and endpoints. All data stored in them will be permanently lost: + delete resources.postgres_projects.my_project + +This action will result in the deletion of the following Lakebase branches. +All data stored in them will be permanently lost: + delete resources.postgres_branches.main + All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/update-postgres-endpoint-[UNIQUE_NAME]/default Deleting files... diff --git a/acceptance/bundle/resources/postgres_projects/basic/output.txt b/acceptance/bundle/resources/postgres_projects/basic/output.txt index 8c1288cb084..3fb4b9ee8a9 100644 --- a/acceptance/bundle/resources/postgres_projects/basic/output.txt +++ b/acceptance/bundle/resources/postgres_projects/basic/output.txt @@ -64,6 +64,10 @@ Resources: The following resources will be deleted: delete resources.postgres_projects.my_project +This action will result in the deletion of the following Lakebase projects along with +all their branches, databases, and endpoints. All data stored in them will be permanently lost: + delete resources.postgres_projects.my_project + All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/deploy-postgres-single-project-[UNIQUE_NAME]/default Deleting files... diff --git a/acceptance/bundle/resources/postgres_projects/recreate/output.txt b/acceptance/bundle/resources/postgres_projects/recreate/output.txt index 950ef936b9e..dad581aa51e 100644 --- a/acceptance/bundle/resources/postgres_projects/recreate/output.txt +++ b/acceptance/bundle/resources/postgres_projects/recreate/output.txt @@ -51,6 +51,10 @@ resources: >>> [CLI] bundle deploy --auto-approve Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/deploy-postgres-recreate-[UNIQUE_NAME]/default/files... + +This action will result in the deletion or recreation of the following Lakebase projects along with +all their branches, databases, and endpoints. All data stored in them will be permanently lost: + recreate resources.postgres_projects.my_project Deploying resources... Updating deployment state... Deployment complete! @@ -61,6 +65,10 @@ Deployment complete! The following resources will be deleted: delete resources.postgres_projects.my_project +This action will result in the deletion of the following Lakebase projects along with +all their branches, databases, and endpoints. All data stored in them will be permanently lost: + delete resources.postgres_projects.my_project + All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/deploy-postgres-recreate-[UNIQUE_NAME]/default Deleting files... diff --git a/acceptance/bundle/resources/postgres_projects/update_display_name/output.txt b/acceptance/bundle/resources/postgres_projects/update_display_name/output.txt index 61829ead707..e709f77c8a9 100644 --- a/acceptance/bundle/resources/postgres_projects/update_display_name/output.txt +++ b/acceptance/bundle/resources/postgres_projects/update_display_name/output.txt @@ -157,6 +157,10 @@ Deployment complete! The following resources will be deleted: delete resources.postgres_projects.my_project +This action will result in the deletion of the following Lakebase projects along with +all their branches, databases, and endpoints. All data stored in them will be permanently lost: + delete resources.postgres_projects.my_project + All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/update-postgres-project-[UNIQUE_NAME]/default Deleting files... diff --git a/acceptance/bundle/resources/synced_database_tables/basic/output.txt b/acceptance/bundle/resources/synced_database_tables/basic/output.txt index 7e8871433fd..b1fac3c7678 100644 --- a/acceptance/bundle/resources/synced_database_tables/basic/output.txt +++ b/acceptance/bundle/resources/synced_database_tables/basic/output.txt @@ -50,6 +50,14 @@ The following resources will be deleted: delete resources.database_instances.my_instance delete resources.synced_database_tables.my_synced_table +This action will result in the deletion of the following Lakebase database instances. +All data stored in them will be permanently lost: + delete resources.database_instances.my_instance + +This action will result in the deletion of the following synced database tables. +The synced data in the destination database will be lost (the source table is preserved): + delete resources.synced_database_tables.my_synced_table + All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/deploy-lakebase-synced-table-[UNIQUE_NAME]/default Deleting files... diff --git a/bundle/phases/deploy.go b/bundle/phases/deploy.go index ac53e35b654..38389b9adb2 100644 --- a/bundle/phases/deploy.go +++ b/bundle/phases/deploy.go @@ -39,9 +39,15 @@ func approvalForDeploy(ctx context.Context, b *bundle.Bundle, plan *deployplan.P pipelineActions := filterGroup(actions, "pipelines", types...) volumeActions := filterGroup(actions, "volumes", types...) dashboardActions := filterGroup(actions, "dashboards", types...) + databaseInstanceActions := filterGroup(actions, "database_instances", types...) + syncedDatabaseTableActions := filterGroup(actions, "synced_database_tables", types...) + postgresProjectActions := filterGroup(actions, "postgres_projects", types...) + postgresBranchActions := filterGroup(actions, "postgres_branches", types...) // We don't need to display any prompts in this case. - if len(schemaActions) == 0 && len(pipelineActions) == 0 && len(volumeActions) == 0 && len(dashboardActions) == 0 { + if len(schemaActions) == 0 && len(pipelineActions) == 0 && len(volumeActions) == 0 && len(dashboardActions) == 0 && + len(databaseInstanceActions) == 0 && len(syncedDatabaseTableActions) == 0 && + len(postgresProjectActions) == 0 && len(postgresBranchActions) == 0 { return true, nil } @@ -80,6 +86,38 @@ func approvalForDeploy(ctx context.Context, b *bundle.Bundle, plan *deployplan.P } } + // One or more database instances is being deleted or recreated. + if len(databaseInstanceActions) != 0 { + cmdio.LogString(ctx, deleteOrRecreateDatabaseInstanceMessage) + for _, action := range databaseInstanceActions { + cmdio.Log(ctx, action) + } + } + + // One or more synced database tables is being deleted or recreated. + if len(syncedDatabaseTableActions) != 0 { + cmdio.LogString(ctx, deleteOrRecreateSyncedDatabaseTableMessage) + for _, action := range syncedDatabaseTableActions { + cmdio.Log(ctx, action) + } + } + + // One or more Lakebase projects is being deleted or recreated. + if len(postgresProjectActions) != 0 { + cmdio.LogString(ctx, deleteOrRecreatePostgresProjectMessage) + for _, action := range postgresProjectActions { + cmdio.Log(ctx, action) + } + } + + // One or more Lakebase branches is being deleted or recreated. + if len(postgresBranchActions) != 0 { + cmdio.LogString(ctx, deleteOrRecreatePostgresBranchMessage) + for _, action := range postgresBranchActions { + cmdio.Log(ctx, action) + } + } + if b.AutoApprove { return true, nil } diff --git a/bundle/phases/destroy.go b/bundle/phases/destroy.go index ebfe3155281..4abc6140e45 100644 --- a/bundle/phases/destroy.go +++ b/bundle/phases/destroy.go @@ -54,6 +54,10 @@ func approvalForDestroy(ctx context.Context, b *bundle.Bundle, plan *deployplan. schemaActions := filterGroup(deleteActions, "schemas", deployplan.Delete) pipelineActions := filterGroup(deleteActions, "pipelines", deployplan.Delete) volumeActions := filterGroup(deleteActions, "volumes", deployplan.Delete) + databaseInstanceActions := filterGroup(deleteActions, "database_instances", deployplan.Delete) + syncedDatabaseTableActions := filterGroup(deleteActions, "synced_database_tables", deployplan.Delete) + postgresProjectActions := filterGroup(deleteActions, "postgres_projects", deployplan.Delete) + postgresBranchActions := filterGroup(deleteActions, "postgres_branches", deployplan.Delete) if len(schemaActions) > 0 { cmdio.LogString(ctx, deleteSchemaMessage) @@ -79,6 +83,38 @@ func approvalForDestroy(ctx context.Context, b *bundle.Bundle, plan *deployplan. cmdio.LogString(ctx, "") } + if len(databaseInstanceActions) > 0 { + cmdio.LogString(ctx, deleteDatabaseInstanceMessage) + for _, a := range databaseInstanceActions { + cmdio.Log(ctx, a) + } + cmdio.LogString(ctx, "") + } + + if len(syncedDatabaseTableActions) > 0 { + cmdio.LogString(ctx, deleteSyncedDatabaseTableMessage) + for _, a := range syncedDatabaseTableActions { + cmdio.Log(ctx, a) + } + cmdio.LogString(ctx, "") + } + + if len(postgresProjectActions) > 0 { + cmdio.LogString(ctx, deletePostgresProjectMessage) + for _, a := range postgresProjectActions { + cmdio.Log(ctx, a) + } + cmdio.LogString(ctx, "") + } + + if len(postgresBranchActions) > 0 { + cmdio.LogString(ctx, deletePostgresBranchMessage) + for _, a := range postgresBranchActions { + cmdio.Log(ctx, a) + } + cmdio.LogString(ctx, "") + } + cmdio.LogString(ctx, "All files and directories at the following location will be deleted: "+b.Config.Workspace.RootPath) cmdio.LogString(ctx, "") diff --git a/bundle/phases/messages.go b/bundle/phases/messages.go index 625373dd8b1..347df8ece43 100644 --- a/bundle/phases/messages.go +++ b/bundle/phases/messages.go @@ -20,6 +20,22 @@ is removed from the catalog, but the underlying files are not deleted:` deleteOrRecreateDashboardMessage = ` This action will result in the deletion or recreation of the following dashboards. This will result in changed IDs and permanent URLs of the dashboards that will be recreated:` + + deleteOrRecreateDatabaseInstanceMessage = ` +This action will result in the deletion or recreation of the following Lakebase database instances. +All data stored in them will be permanently lost:` + + deleteOrRecreateSyncedDatabaseTableMessage = ` +This action will result in the deletion or recreation of the following synced database tables. +The synced data in the destination database will be lost (the source table is preserved):` + + deleteOrRecreatePostgresProjectMessage = ` +This action will result in the deletion or recreation of the following Lakebase projects along with +all their branches, databases, and endpoints. All data stored in them will be permanently lost:` + + deleteOrRecreatePostgresBranchMessage = ` +This action will result in the deletion or recreation of the following Lakebase branches. +All data stored in them will be permanently lost:` ) // Messages for bundle destroy. @@ -33,4 +49,16 @@ Streaming Tables (STs) and Materialized Views (MVs) managed by them:` For managed volumes, the files stored in the volume are also deleted from your cloud tenant within 30 days. For external volumes, the metadata about the volume is removed from the catalog, but the underlying files are not deleted:` + + deleteDatabaseInstanceMessage = `This action will result in the deletion of the following Lakebase database instances. +All data stored in them will be permanently lost:` + + deleteSyncedDatabaseTableMessage = `This action will result in the deletion of the following synced database tables. +The synced data in the destination database will be lost (the source table is preserved):` + + deletePostgresProjectMessage = `This action will result in the deletion of the following Lakebase projects along with +all their branches, databases, and endpoints. All data stored in them will be permanently lost:` + + deletePostgresBranchMessage = `This action will result in the deletion of the following Lakebase branches. +All data stored in them will be permanently lost:` ) From c6a36b9dbb412aa708cf72705ba0269f117765d0 Mon Sep 17 00:00:00 2001 From: Pieter Noordhuis Date: Tue, 21 Apr 2026 16:00:19 +0200 Subject: [PATCH 2/2] Regenerate database_catalogs/basic output This test bundles a database instance alongside the catalog, so it picks up the new Lakebase destroy warning. Co-authored-by: Isaac --- .../bundle/resources/database_catalogs/basic/output.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/acceptance/bundle/resources/database_catalogs/basic/output.txt b/acceptance/bundle/resources/database_catalogs/basic/output.txt index 46105a3e8c6..ce8eb0746eb 100644 --- a/acceptance/bundle/resources/database_catalogs/basic/output.txt +++ b/acceptance/bundle/resources/database_catalogs/basic/output.txt @@ -47,6 +47,10 @@ The following resources will be deleted: delete resources.database_catalogs.my_catalog delete resources.database_instances.my_instance +This action will result in the deletion of the following Lakebase database instances. +All data stored in them will be permanently lost: + delete resources.database_instances.my_instance + All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/deploy-lakebase-catalog-[UNIQUE_NAME]/default Deleting files...