Skip to content

feat(datastore/mongo): logical flavour#362

Merged
anshulsao merged 2 commits into
mainfrom
feat/mongo-reference-flavour
Jun 22, 2026
Merged

feat(datastore/mongo): logical flavour#362
anshulsao merged 2 commits into
mainfrom
feat/mongo-reference-flavour

Conversation

@anshulsao

@anshulsao anshulsao commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a new logical flavour for datastore/mongo — a logical database hosted on an existing / shared mongo / DocumentDB instance. It creates no cloud resources and requires no provider; it re-exposes the connection outputs of an already-provisioned mongo / DocumentDB datastore.

(Named logical rather than reference to avoid clashing with Facets' cross-blueprint reference concept.)

The host instance is selected via the source spec field (x-ui-output-type: '@facets/mongo'), which resolves the SELECTED resource's full outputs (interfaces + attributes) into var.instance.spec.source. Because it is an ordinary spec field, it is per-environment override-able — point staging and prod at different physical clusters.

Covers AWS DocumentDB and any other @facets/mongo-emitting flavour.

Use case: staging DB consolidation — collapse multiple logical databases onto a single physical mongo/DocumentDB cluster while each logical resource keeps its own connection contract.

Behaviour

  • Output type: @facets/mongo (same contract as the other mongo flavours).
  • No resources / no provider: main.tf declares only terraform { required_version } — zero resources, zero required_providers.
  • Outputs: re-emits writer / reader / cluster interfaces (host / port / username / password / connection_string / name / secrets) plus passthrough attributes from var.instance.spec.source.
  • database_name (optional): when set, the logical DB is spliced into each connection string and the name field, preserving existing query params (tls, replicaSet, etc.). lookup() used for all optionals.

Validation

  • terraform fmt, init -backend=false, validate — all pass.
  • raptor create iac-module --dry-run — all checks pass (no-provider, variables, fmt, init, validate, security) except the @facets/mongo output-type catalog lookup, which fails identically for the existing aws-documentdb flavour. This is a pre-existing server-catalog gap, not specific to this module.

🤖 Generated with Claude Code

https://claude.ai/code/session_01PKZUrLtUbJS5GuEyRA8Vd5

anshulsao and others added 2 commits June 22, 2026 11:38
…ting mongo datastore's outputs (no resources)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PKZUrLtUbJS5GuEyRA8Vd5
"reference" clashes with Facets' cross-blueprint reference concept.
"logical" = a logical database hosted on a shared physical instance.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PKZUrLtUbJS5GuEyRA8Vd5
@anshulsao anshulsao changed the title feat(datastore/mongo): reference flavour feat(datastore/mongo): logical flavour Jun 22, 2026
@anshulsao
anshulsao merged commit 5030e38 into main Jun 22, 2026
@anshulsao
anshulsao deleted the feat/mongo-reference-flavour branch June 22, 2026 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant