postgres: Support replace_existing on databases and roles#5803
Merged
Conversation
Co-authored-by: Isaac
# Conflicts: # libs/structs/structwalk/walktype_test.go
Bump the pinned Databricks Terraform provider from v1.118.0 to v1.120.0, regenerate bundle/internal/tf/schema (and its ProviderVersion/checksums), and refresh the affected acceptance goldens. Co-authored-by: Isaac
Co-authored-by: Isaac
Co-authored-by: Isaac
Extend the replace_existing pattern already used by postgres_branches and postgres_endpoints to databases and roles: a bundle can take over a database or role that already exists on a Lakebase branch instead of failing with ALREADY_EXISTS. The Terraform provider does not support replace_existing for databases/roles yet, so the new acceptance tests are locked to the direct engine for now. Co-authored-by: Isaac
The Terraform provider 1.120.0 bump adds replace_existing to the postgres_database and postgres_role schemas, so the new acceptance tests can run on terraform in addition to direct. The recorded request set diverges between engines (terraform omits the extra GET polls and includes parent in the body), so the deploy requests are split into per-engine out.requests.deploy.<engine>.json. Co-authored-by: Isaac
…ting-database-role # Conflicts: # NEXT_CHANGELOG.md # bundle/terraform_dabs_map/generated.go
Co-authored-by: Isaac
Collaborator
Integration test reportCommit: b405b1d
10 interesting tests: 5 flaky, 4 SKIP, 1 RECOVERED
Top 11 slowest tests (at least 2 minutes):
|
…ting-database-role # Conflicts: # NEXT_CHANGELOG.md
…hanges Revert branch/endpoint replace_existing annotations to PLACEHOLDER so this PR only carries new descriptions for postgres_databases and postgres_roles. Co-authored-by: Isaac
…ting-database-role
replace_existing on databases and roles
janniklasrose
approved these changes
Jul 8, 2026
| Updating deployment state... | ||
| Deployment complete! | ||
|
|
||
| === Confirm the role is under management again |
Contributor
There was a problem hiding this comment.
would be nice to see get-role after unbind to observe the difference
The unbind-staging flow works identically on cloud (unbind only edits local bundle state; the resource stays on the branch), so these tests can run against the real Lakebase API. Drop the Cloud = false override (empty test.toml removed; inherits Cloud = true from the parent) and refresh out.test.toml. Verified on aws-prod-ucws: both engines adopt the existing database/role with replace_existing, no golden drift. Co-authored-by: Isaac
deco-sdk-tagging Bot
added a commit
that referenced
this pull request
Jul 9, 2026
## Release v1.7.0 ### CLI * An explicitly selected profile (`--profile` or a bundle's `workspace.profile`) now takes precedence over auth environment variables (`DATABRICKS_HOST`, `DATABRICKS_TOKEN`, etc.) instead of being silently shadowed by them; env vars still fill auth fields the profile leaves empty ([#5096](#5096)). * Fix intermittent crashes when processing pages from API calls ([#5815](#5815)). ### Bundles * direct: add basic version of job_runs resource (experimental) ([#5603](#5603)). * Fix permissions added to a job or pipeline by a Python (PyDABs) mutator failing to deploy with "must have exactly one owner"; the deploying identity is now set as owner, matching resources whose permissions are declared in YAML ([#5821](#5821)). * Remove duplicate enum values for jsonschema.json ([#5839](#5839)). * direct: volumes: support `volume_path` property ([#5550](#5550)). * direct: Fix deploy bug when a `postgres_projects`, `postgres_branches`, or `postgres_endpoints` field is set to its zero value (e.g. `enable_pg_native_login: false`, `replace_existing: false`) ([#5782](#5782)). * `bundle run --only` help now documents the `+` modifier syntax: prefix a task key with `+` to also run its upstream tasks, or suffix it with `+` for downstream tasks ([#5760](#5760)). * direct: Recognize UC-managed catalog and schema property defaults to avoid unnecessary drift ([#5865](#5865) & [#5870](#5870)). * Fix `bundle deploy --select <resource>` skipping the resource's grants and permissions; they are now applied as part of the selected resource ([#5852](#5852)). * Support `purge_on_delete: true` on `postgres_branches` so bundles can hard-delete a Lakebase branch on destroy (skipping the soft-delete retention window) ([#5801](#5801)). * Support `replace_existing: true` on `postgres_databases` and `postgres_roles` so bundles can take over a database or role that already exists on a Lakebase branch instead of failing with `ALREADY_EXISTS` ([#5803](#5803)). ### Dependency updates * Bump databricks-sdk-go to v0.154.0 ([#5855](#5855)). * Bump terraform-provider to 1.121.0 ([#5857](#5857)). * Bump OpenTelemetry dependencies to v1.44.0 to address [CVE-2026-41178](GHSA-5wrp-cwcj-q835) ([#5873](#5873)).
Collaborator
Integration test reportCommit: 681f8b0
29 interesting tests: 12 flaky, 9 FAIL, 5 RECOVERED, 2 SKIP, 1 KNOWN
Top 50 slowest tests (at least 2 minutes):
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Extends the
replace_existingpattern frompostgres_branches/postgres_endpoints(#5264) topostgres_databasesandpostgres_roles. Whentrue, the create call takes over a database or role that already exists on a Lakebase branch — for example a role inherited from the parent branch — instead of failing withALREADY_EXISTS.The flag is input-only; the GET API never echoes it, so
RemapStatepins it tofalseand anignore_local_changesrule makes toggling it after create a no-op.Acceptance tests cover the deploy → unbind → re-deploy adoption flow on both engines and assert
replace_existing=trueis sent.This pull request and its description were written by Isaac.