feat(datastore/postgres): logical flavour#361
Merged
Conversation
…xisting postgres datastore's outputs (no resources); enables per-env DB consolidation references Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PKZUrLtUbJS5GuEyRA8Vd5
'reference' clashed with Facets' cross-blueprint reference concept. 'logical' better names the use case: a logical database hosted on an existing/shared physical postgres instance. Renames the flavour dir, flavor field, titles, descriptions, and catalog/README/index.html/project-type entries. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PKZUrLtUbJS5GuEyRA8Vd5
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.
What
Adds a new
logicalflavour fordatastore/postgresatmodules/datastore/postgres/logical/1.0.This flavour models a logical database hosted on an existing/shared PostgreSQL instance. It creates no cloud resources and declares no providers: it references an existing postgres instance and re-exposes that instance's connection outputs under the same
@facets/postgrescontract thataws-rdsandaws-auroraemit (so consumers can't tell a logical DB from a dedicated instance).How it works
spec.source— a spec field withx-ui-output-type: '@facets/postgres'. This resolves to the selected resource's full outputs (interfaces + attributes) injected intovar.instance.spec.source. Because it's a spec field, the target is per-environment override-able — the same blueprint resource can point at different shared instances across environments (e.g. via a--flavor/override on stage).spec.database_name— optional, override-only. The logical DB name to target on the shared host. When set, thereader/writerconnection_stringis rebuilt aspostgres://<source-user>:<source-pass>@<source-host>:<source-port>/<database_name>(credentials/host/port inherited from the source; only the database segment swapped). When unset, the source connection string passes through verbatim.main.tfdeclares no resources;outputs.tfre-emitsoutput_interfaces.reader/writer(host, port, username, password, connection_string, secrets) and passes throughoutput_attributesfrom the source.Coverage
Because both
aws-rdsandaws-auroraemit@facets/postgres, this single logical flavour covers both as source instances.Use case
Staging DB consolidation — a logical database that points at a shared physical instance. Deploy one real postgres instance, then one
postgres/logicalper service withsource-> the shared instance anddatabase_name-> the service's logical DB. Blueprints stay identical across environments while non-prod consolidates physical infra.Validation
terraform fmt/init -backend=false/validate— clean.raptor create iac-module -f modules/datastore/postgres/logical/1.0 --dry-run— all validations pass (facets.yaml, var.inputs, var.instance.spec, no provider blocks, terraform validate, output types). Trivy not installed locally so the security scan was skipped (no scan findings; nothing security-relevant — module provisions nothing).README.md,index.html, and all threeproject-type/{aws,gcp,azure}/project-type.yml(cloud-neutral flavour, added to all). Icon already exists (icons/postgres.svg).🤖 Generated with Claude Code
https://claude.ai/code/session_01PKZUrLtUbJS5GuEyRA8Vd5