Add postgres_catalogs bundle resource#5265
Open
pietern wants to merge 7 commits into
Open
Conversation
## Changes
New `postgres_catalogs` resource binding a Unity Catalog catalog to a Postgres database on a Lakebase Autoscaling branch. Supported on both direct and terraform deployment engines.
The spec fields are classified as both `recreate_on_changes` and `ignore_remote_changes: input_only`. The two cover orthogonal diffs the planner runs — recreate fires on local edits to an immutable field, and ignore_remote silences the phantom drift from GET not echoing spec back today. Lift the `input_only` entries once the backend starts returning spec.
## Tests
Acceptance coverage: `basic` and `recreate` exercise each engine, plus the existing `no_drift` and `migrate` invariants pick up the new resource. Both engines produce identical human-readable output and identical wire bodies; only the captured request streams diverge by filename (`out.requests.{direct,terraform}.json`).
Verified end to end on a live workspace: the bundle deploys a project and catalog, a row written directly into the bound Postgres database becomes visible through the UC federated view, and a follow-up write shows up on re-read.
This pull request and its description were written by Isaac.
This pull request and its description were written by Isaac.
The hand-written `branch`, `postgres_database`, and `create_database_if_missing` entries under `ignore_remote_changes` are already produced by the OpenAPI autogen (`spec:input_only`); `postgres_database` is also autogen'd under `recreate_on_changes` (`spec:immutable`). Drop the duplicates from `resources.yml`. `catalog_id` was in `ignore_remote_changes` only to mask the cosmetic `catalogs/` prefix that the old `RemapState` propagated from `remote.Name`. Source it from `remote.Status.CatalogId` instead — semantic contract from the API rather than string manipulation on the hierarchical path — and drop the entry. `catalog_id` stays in `recreate_on_changes` (synthetic hierarchical key, not in the API spec) along with `branch` and `create_database_if_missing` (no UpdateCatalog endpoint). Co-authored-by: Isaac
denik
reviewed
May 19, 2026
| return "", nil, err | ||
| } | ||
|
|
||
| result, err := waiter.Wait(ctx) |
Contributor
There was a problem hiding this comment.
Can we put waiting into to WaitAfterCreate()? I understand we cannot use waiter convenience wrapper, but I'm sure there is API.
Splitting ensures that there is no orphaned resources if the process crashes during waiting.
The medium term plan is to move waiting into framework, splitting now would help.
Contributor
Author
There was a problem hiding this comment.
Similar discussion here: #4423 (comment)
The outcome there was to do a follow-up but that didn't happen.
I'll file a ticket for this on direct engine to solve this generically for LROs.
andrewnester
approved these changes
May 19, 2026
Contributor
andrewnester
left a comment
There was a problem hiding this comment.
Do we support binding the catalogs? If so, worth adding an acceptance test as well
Direct and terraform engines produced identical output. Per the repo rule in .agent/rules/testing.md, only diverging files should be split into per-engine variants; this matches the precedent set by postgres_projects/basic. Co-authored-by: Isaac
Apply the same hoist that #5273 does for Branch/Endpoint/Project. Define PostgresCatalogRemote that embeds CatalogCatalogSpec and exposes the identifier and output-only fields at the top level. DoRead returns the new shape so state-side and remote-side paths line up, which is a prerequisite for drift detection on spec fields once the backend echoes spec on GET. Today the embedded fields are auto-classified spec:input_only from the API field behaviors in resources.generated.yml, so drift is correctly suppressed. Prompted by #5265 (comment). Should land after #5273. Co-authored-by: Isaac
# Conflicts: # NEXT_CHANGELOG.md # libs/testserver/fake_workspace.go
These annotations crept into the schema regeneration when the postgres_catalogs commit (3857f0f) was first generated; they belong to other fields and should not ride along with this PR. Keep only the postgres_catalogs additions. Co-authored-by: Isaac
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.
Changes
New
postgres_catalogsresource binding a Unity Catalog catalog to a Postgres database on a Lakebase Autoscaling branch. Supported on both direct and terraform deployment engines.Tests
Acceptance coverage:
basicandrecreateexercise each engine, plus the existingno_driftandmigrateinvariants pick up the new resource. Both engines produce identical human-readable output and identical wire bodies; only the captured request streams diverge by filename (out.requests.{direct,terraform}.json).Verified end to end on a live workspace: the bundle deploys a project and catalog, a row written directly into the bound Postgres database becomes visible through the UC federated view, and a follow-up write shows up on re-read.
This pull request and its description were written by Isaac.