From b9ad0104959787ba3d9fc064d6358d85c54636f6 Mon Sep 17 00:00:00 2001 From: Aman Varshney Date: Thu, 26 Feb 2026 13:10:56 +0530 Subject: [PATCH 01/11] docs(postgres): restore IaC guides (Terraform, Pulumi, Alchemy) Re-adds the Infrastructure as Code guides that were lost during the docs restructure. Includes guides for Terraform, Pulumi, and Alchemy, along with a section index and updated postgres meta.json. --- .../content/docs/postgres/iac/alchemy.mdx | 242 ++++++++++++++++++ apps/docs/content/docs/postgres/iac/index.mdx | 13 + apps/docs/content/docs/postgres/iac/meta.json | 4 + .../docs/content/docs/postgres/iac/pulumi.mdx | 167 ++++++++++++ .../content/docs/postgres/iac/terraform.mdx | 179 +++++++++++++ apps/docs/content/docs/postgres/meta.json | 2 + 6 files changed, 607 insertions(+) create mode 100644 apps/docs/content/docs/postgres/iac/alchemy.mdx create mode 100644 apps/docs/content/docs/postgres/iac/index.mdx create mode 100644 apps/docs/content/docs/postgres/iac/meta.json create mode 100644 apps/docs/content/docs/postgres/iac/pulumi.mdx create mode 100644 apps/docs/content/docs/postgres/iac/terraform.mdx diff --git a/apps/docs/content/docs/postgres/iac/alchemy.mdx b/apps/docs/content/docs/postgres/iac/alchemy.mdx new file mode 100644 index 0000000000..e3a5d00709 --- /dev/null +++ b/apps/docs/content/docs/postgres/iac/alchemy.mdx @@ -0,0 +1,242 @@ +--- +title: Alchemy +description: Provision and manage Prisma Postgres projects, databases, and connections with Alchemy. +metaTitle: Manage Prisma Postgres with Alchemy +metaDescription: Provision and manage Prisma Postgres projects, databases, and connections with Alchemy. +url: /postgres/iac/alchemy +tocDepth: 3 +toc: true +--- + +Use [Alchemy](https://alchemy.run) to manage Prisma Postgres resources directly in your infrastructure code. + +Alchemy provides Prisma Postgres resources for: + +- Projects +- Databases +- Connections +- Workspace references + +## Conceptual model + +Alchemy is a TypeScript library that creates and manages infrastructure when you run it. + +Instead of a separate declarative config format, you write a normal TypeScript program (commonly `alchemy.run.ts`) and execute it. + +Alchemy resources follow lifecycle phases (`create`, `update`, `delete`) and manage provider APIs for you: + +- You compose resources in code (`Project`, `Database`, `Connection`). +- Alchemy handles dependency ordering between those resources. +- Resource defaults can include safety behavior, such as delete protection on projects and databases. +- `await app.finalize()` cleans up orphaned resources that are no longer in your program. + +This makes it useful when you want infrastructure code that feels close to your application runtime and platform integrations. + +## When to use Alchemy + +Alchemy is a strong fit when: + +- You are already deploying with Alchemy and want Prisma Postgres in the same graph. +- You want resource composition with first-class platform integrations (for example, Hyperdrive + Workers). +- You prefer lifecycle-driven resource code with safe deletion defaults. + +## Typical workflow + +If you follow the Alchemy getting started flow, the common lifecycle is: + +```terminal +# create project scaffold (optional) +bunx alchemy@latest create --template typescript + +# configure provider profiles/credentials +bun alchemy configure + +# authenticate (required for Cloudflare resources) +bun alchemy login + +# local development with hot reload +bun alchemy dev + +# deploy +bun alchemy deploy + +# tear down +bun alchemy destroy +``` + +For Prisma Postgres-only resources, `configure`/`login` may not be necessary in every setup. They are typically needed when you also manage Cloudflare resources in the same app. + +## Prerequisites + +- An Alchemy project +- A Prisma service token +- `PRISMA_SERVICE_TOKEN` configured in your environment +- `ALCHEMY_PASSWORD` configured when your resources contain secrets + +## Authentication + +Alchemy reads Prisma credentials from environment variables by default. + +```terminal +export PRISMA_SERVICE_TOKEN="prsc_your_token_here" +export ALCHEMY_PASSWORD="choose-a-strong-password" +``` + +If you need multiple workspaces/accounts, you can override auth per resource with `serviceToken`. + +`ALCHEMY_PASSWORD` is used to encrypt/decrypt secret values in Alchemy state. + +## Minimal example + +```ts file=alchemy.run.ts +import alchemy from "alchemy"; +import { Connection, Database, Project } from "alchemy/prisma-postgres"; + +const app = await alchemy("prisma-postgres-example"); + +const project = await Project("project"); + +const database = await Database("database", { + project, + region: "us-east-1", +}); + +const connection = await Connection("connection", { + database, + name: "app-connection", +}); + +export const projectId = project.id; +export const databaseId = database.id; +export const host = connection.host; +export const user = connection.user; +export const connectionString = connection.connectionString; +export const prismaConnectionString = connection.prismaConnectionString; + +await app.finalize(); +``` + +## Complete example with Hyperdrive + Worker + +```ts file=alchemy.run.ts +import alchemy from "alchemy"; +import { Hyperdrive, Worker } from "alchemy/cloudflare"; +import { Connection, Database, Project } from "alchemy/prisma-postgres"; + +const app = await alchemy("prisma-postgres-example"); + +const project = await Project("project"); + +const database = await Database("database", { + project, + region: "us-east-1", +}); + +const connection = await Connection("connection", { + database, + name: "connection", +}); + +const db = await Hyperdrive("prisma-postgres", { + origin: connection.connectionString.unencrypted, +}); + +export const worker = await Worker("worker", { + entrypoint: "src/worker.ts", + bindings: { + HYPERDRIVE: db, + }, + compatibilityFlags: ["nodejs_compat"], +}); + +await app.finalize(); +``` + +```ts file=src/worker.ts +import { Client } from "pg"; +import type { worker } from "../alchemy.run.ts"; + +export default { + async fetch(_request: Request, env: typeof worker.Env): Promise { + const client = new Client({ + connectionString: env.HYPERDRIVE.connectionString, + }); + + try { + await client.connect(); + const result = await client.query("SELECT * FROM pg_tables"); + + return Response.json({ + success: true, + result: result.rows, + }); + } catch (error: any) { + return new Response(`Database error: ${error.message}`, { status: 500 }); + } + }, +}; +``` + +## Working with multiple workspaces + +Prisma service tokens are workspace-scoped. You can pass different tokens to different resources: + +```ts +import alchemy from "alchemy"; +import { Project } from "alchemy/prisma-postgres"; + +const app = await alchemy("prisma-workspaces"); + +const workspaceAProject = await Project("workspace-a-project", { + serviceToken: alchemy.env.PRISMA_SERVICE_TOKEN_WORKSPACE_A, +}); + +const workspaceBProject = await Project("workspace-b-project", { + serviceToken: alchemy.env.PRISMA_SERVICE_TOKEN_WORKSPACE_B, +}); + +await app.finalize(); +``` + +If you need to resolve a workspace by name or id, use `WorkspaceRef`: + +```ts +import { WorkspaceRef } from "alchemy/prisma-postgres"; + +const workspace = await WorkspaceRef("my-workspace"); +``` + +## Deletion behavior + +`Project` and `Database` default to delete protection in Alchemy. + +- `Project`: `delete` defaults to `false` +- `Database`: `delete` defaults to `false` + +For ephemeral environments, set `delete: true` explicitly: + +```ts +const testDatabase = await Database("test-db", { + project, + region: "us-east-1", + delete: true, +}); +``` + +## Common troubleshooting + +### Missing token + +If resource creation fails with an auth error, confirm `PRISMA_SERVICE_TOKEN` is set for the process running Alchemy. + +### Wrong workspace + +Prisma service tokens are workspace-scoped. If resources appear in the wrong workspace, use per-resource `serviceToken` overrides. + +## References + +- [Alchemy](https://alchemy.run) +- [Alchemy getting started](https://alchemy.run/getting-started) +- [What is Alchemy?](https://alchemy.run/what-is-alchemy/) +- [Alchemy package on npm](https://www.npmjs.com/package/alchemy) +- [Prisma Postgres](https://www.prisma.io/postgres) diff --git a/apps/docs/content/docs/postgres/iac/index.mdx b/apps/docs/content/docs/postgres/iac/index.mdx new file mode 100644 index 0000000000..7b52153b28 --- /dev/null +++ b/apps/docs/content/docs/postgres/iac/index.mdx @@ -0,0 +1,13 @@ +--- +title: Infrastructure as Code +description: Manage Prisma Postgres with Infrastructure as Code tools like Terraform, Pulumi, and Alchemy. +metaTitle: Infrastructure as Code for Prisma Postgres +metaDescription: Manage Prisma Postgres with Infrastructure as Code tools like Terraform, Pulumi, and Alchemy. +url: /postgres/iac +--- + +Use Infrastructure as Code (IaC) to provision and manage Prisma Postgres resources in a repeatable way with tools like Terraform, Pulumi, and Alchemy. + +## In this section + + diff --git a/apps/docs/content/docs/postgres/iac/meta.json b/apps/docs/content/docs/postgres/iac/meta.json new file mode 100644 index 0000000000..b27621faa3 --- /dev/null +++ b/apps/docs/content/docs/postgres/iac/meta.json @@ -0,0 +1,4 @@ +{ + "title": "Infrastructure as Code", + "pages": ["index", "terraform", "pulumi", "alchemy"] +} diff --git a/apps/docs/content/docs/postgres/iac/pulumi.mdx b/apps/docs/content/docs/postgres/iac/pulumi.mdx new file mode 100644 index 0000000000..8eb4edc314 --- /dev/null +++ b/apps/docs/content/docs/postgres/iac/pulumi.mdx @@ -0,0 +1,167 @@ +--- +title: Pulumi +description: Provision and manage Prisma Postgres with Pulumi using the Prisma Terraform provider bridge. +metaTitle: Manage Prisma Postgres with Pulumi +metaDescription: Provision and manage Prisma Postgres with Pulumi using the Prisma Terraform provider bridge. +url: /postgres/iac/pulumi +tocDepth: 3 +toc: true +--- + +Use Pulumi with the Prisma Postgres Terraform provider through the Pulumi Terraform bridge. + +This is the currently supported path for managing Prisma Postgres from Pulumi. + +## Conceptual model + +Pulumi lets you define infrastructure with a general-purpose language, but still deploys declaratively: + +- You write resource code in TypeScript. +- Pulumi builds a dependency graph and previews changes (`pulumi preview`/`pulumi up`). +- Stack state tracks what exists, including secret outputs. + +In this guide, Pulumi consumes the Prisma Terraform provider through a generated SDK, so you get typed resources while reusing the same provider capabilities. + +## When to use Pulumi + +Pulumi is a strong fit when: + +- You want infrastructure and application code in the same language. +- You prefer typed APIs and IDE support over HCL. +- You already use Pulumi stacks for environment management. + +## Prerequisites + +- [Pulumi CLI](https://www.pulumi.com/docs/iac/download-install/) +- A Pulumi TypeScript project (create one with `pulumi new typescript`) +- A Prisma service token (see [Management API authentication docs](/postgres/introduction/management-api#service-tokens)) + +## 1. Optional: use Bun for dependency installs + +If you want Pulumi to use Bun in this project, set this in `Pulumi.yaml`: + +```yaml file=Pulumi.yaml +runtime: + name: nodejs + options: + packagemanager: bun +``` + +## 2. Add the Prisma Postgres provider package + +From your Pulumi project directory, run: + +```terminal +pulumi package add terraform-provider registry.terraform.io/prisma/prisma-postgres 0.2.0 +``` + +This command: + +- Generates a local SDK in `sdks/prisma-postgres` +- Adds `packages.prisma-postgres` metadata to `Pulumi.yaml` +- Adds `@pulumi/prisma-postgres` to `package.json` as a local file dependency + +### Alternative: local provider binary + +If you are developing the provider locally, you can also add it from a local binary path: + +```terminal +pulumi package add terraform-provider /absolute/path/to/terraform-provider-prisma-postgres +``` + +For most users, the registry form in step 2 is the recommended approach. + +## 3. Configure authentication + +Use one of these methods: + +### Option A: environment variable + +```terminal +export PRISMA_SERVICE_TOKEN="prsc_your_token_here" +``` + +### Option B: Pulumi config secret + +```terminal +pulumi config set prisma-postgres:serviceToken "prsc_your_token_here" --secret +``` + +## 4. Define resources in `index.ts` + +```ts file=index.ts +import * as pulumi from "@pulumi/pulumi"; +import * as prismaPostgres from "@pulumi/prisma-postgres"; + +const project = new prismaPostgres.Project("project", { + name: "my-app", +}); + +const database = new prismaPostgres.Database("database", { + projectId: project.id, + name: "production", + region: "us-east-1", +}); + +const connection = new prismaPostgres.Connection("connection", { + databaseId: database.id, + name: "api-key", +}); + +const availableRegions = prismaPostgres.getRegionsOutput().regions.apply((regions) => + regions.filter((r) => r.status === "available").map((r) => `${r.id} (${r.name})`) +); + +export const projectId = project.id; +export const databaseId = database.id; +export const connectionString = pulumi.secret(connection.connectionString); +export const directUrl = pulumi.secret(database.directUrl); +export const regions = availableRegions; +``` + +## 5. Deploy + +```terminal +pulumi up +``` + +To read secret outputs: + +```terminal +pulumi stack output connectionString --show-secrets +pulumi stack output directUrl --show-secrets +``` + +## 6. Clean up + +```terminal +pulumi destroy +``` + +## Production notes + +- Store Pulumi state in a managed backend (Pulumi Cloud, S3-compatible backend, etc.). +- Keep service tokens in Pulumi secrets/config or your secret manager, never in source files. +- The generated SDK is a local dependency (`file:sdks/prisma-postgres`), so keep it available in CI/CD. +- Pin the Terraform provider version in `pulumi package add` for reproducible deployments. + +## Common troubleshooting + +### Package add failed + +Confirm you're running the command inside a Pulumi project directory containing `Pulumi.yaml`. + +### Missing credentials + +If provider auth fails, verify either `PRISMA_SERVICE_TOKEN` is set or `prisma-postgres:serviceToken` is configured for the current stack. + +### SDK not found in CI + +If CI cannot resolve `@pulumi/prisma-postgres`, make sure `sdks/prisma-postgres` exists in the workspace or rerun `pulumi package add` during CI setup. + +## References + +- [Pulumi package add](https://www.pulumi.com/docs/iac/cli/commands/pulumi_package_add/) +- [Using any Terraform provider in Pulumi](https://www.pulumi.com/docs/iac/concepts/providers/any-terraform-provider/) +- [Prisma Postgres provider on Terraform Registry](https://registry.terraform.io/providers/prisma/prisma-postgres/latest) +- [Prisma Postgres Terraform provider source](https://github.com/prisma/terraform-provider-prisma-postgres) diff --git a/apps/docs/content/docs/postgres/iac/terraform.mdx b/apps/docs/content/docs/postgres/iac/terraform.mdx new file mode 100644 index 0000000000..4804485fac --- /dev/null +++ b/apps/docs/content/docs/postgres/iac/terraform.mdx @@ -0,0 +1,179 @@ +--- +title: Terraform +description: Provision and manage Prisma Postgres projects, databases, and connections using Terraform. +metaTitle: Manage Prisma Postgres with Terraform +metaDescription: Provision and manage Prisma Postgres projects, databases, and connections using Terraform. +url: /postgres/iac/terraform +tocDepth: 3 +toc: true +--- + +Use the [Prisma Postgres Terraform provider](https://registry.terraform.io/providers/prisma/prisma-postgres/latest) to manage projects, databases, and connections with code. + +## Conceptual model + +Terraform is a desired-state engine: + +- You declare the target infrastructure in `.tf` files. +- Terraform computes a plan (`terraform plan`) by comparing config vs current state. +- Terraform applies only the required changes (`terraform apply`) and records the result in state. + +For Prisma Postgres, this gives a predictable workflow for creating projects, databases, and connections across environments. + +## When to use Terraform + +Terraform is a strong fit when: + +- You already manage infrastructure in Terraform and want one workflow. +- You prefer explicit `plan` output before applying changes. +- Your team standardizes on HCL modules and Terraform state backends. + +## What you can manage + +The provider currently supports: + +- `prisma-postgres_project` +- `prisma-postgres_database` +- `prisma-postgres_connection` +- `prisma-postgres_regions` data source + +## Prerequisites + +- [Terraform](https://developer.hashicorp.com/terraform/install) `>= 1.0` +- A Prisma account and workspace in [Prisma Console](https://console.prisma.io) +- A Prisma service token (see [Management API authentication docs](/postgres/introduction/management-api#service-tokens)) + +## 1. Set your service token + +Set your token as an environment variable: + +```terminal +export PRISMA_SERVICE_TOKEN="prsc_your_token_here" +``` + +## 2. Create `main.tf` + +Create the following Terraform configuration: + +```hcl file=main.tf +terraform { + required_providers { + prisma-postgres = { + source = "prisma/prisma-postgres" + } + } +} + +provider "prisma-postgres" {} + +resource "prisma-postgres_project" "main" { + name = "my-app" +} + +resource "prisma-postgres_database" "production" { + project_id = prisma-postgres_project.main.id + name = "production" + region = "us-east-1" +} + +resource "prisma-postgres_connection" "api" { + database_id = prisma-postgres_database.production.id + name = "api-key" +} + +output "connection_string" { + value = prisma-postgres_connection.api.connection_string + sensitive = true +} + +output "direct_url" { + value = prisma-postgres_database.production.direct_url + sensitive = true +} +``` + +## 3. Initialize and apply + +Initialize your working directory: + +```terminal +terraform init +``` + +Review and apply: + +```terminal +terraform plan +terraform apply +``` + +After apply, retrieve values: + +```terminal +terraform output -raw connection_string +terraform output -raw direct_url +``` + +## 4. Clean up (optional) + +```terminal +terraform destroy +``` + +## Optional: discover available regions + +If you want to select regions dynamically: + +```hcl +data "prisma-postgres_regions" "available" {} + +output "available_regions" { + value = [ + for r in data.prisma-postgres_regions.available.regions : "${r.id} (${r.name})" + if r.status == "available" + ] +} +``` + +## Production notes + +- Store Terraform state in a secure remote backend (for example, S3 + DynamoDB, Terraform Cloud, etc.). +- Treat state as sensitive: even with `sensitive = true`, secret values are still stored in state. +- Keep `PRISMA_SERVICE_TOKEN` in your secret manager or CI secrets, not in code. +- Use separate Terraform workspaces or stacks for `dev`, `staging`, and `prod`. +- Rotate credentials intentionally when required by replacing connection resources. + +## Import existing resources + +You can import existing resources into state: + +```terminal +terraform import prisma-postgres_project.main +terraform import prisma-postgres_database.production +terraform import prisma-postgres_connection.api , +``` + +Credentials are only returned at creation time and cannot be recovered after import. + +## Common troubleshooting + +### Missing token + +If provider configuration fails with a missing token error, confirm `PRISMA_SERVICE_TOKEN` is set in the same shell session running Terraform. + +### Region issues + +If create fails for a region value, use `prisma-postgres_regions` to list currently available regions for your workspace. + +### Authorization failures + +If you receive authorization errors, verify your service token belongs to the expected workspace and has permission to create projects and databases. + +## References + +- [Prisma Postgres provider on Terraform Registry](https://registry.terraform.io/providers/prisma/prisma-postgres/latest) +- [Provider configuration](https://registry.terraform.io/providers/prisma/prisma-postgres/latest/docs) +- [Project resource](https://registry.terraform.io/providers/prisma/prisma-postgres/latest/docs/resources/project) +- [Database resource](https://registry.terraform.io/providers/prisma/prisma-postgres/latest/docs/resources/database) +- [Connection resource](https://registry.terraform.io/providers/prisma/prisma-postgres/latest/docs/resources/connection) +- [Regions data source](https://registry.terraform.io/providers/prisma/prisma-postgres/latest/docs/data-sources/regions) diff --git a/apps/docs/content/docs/postgres/meta.json b/apps/docs/content/docs/postgres/meta.json index 843af5a0f1..a7987bb803 100644 --- a/apps/docs/content/docs/postgres/meta.json +++ b/apps/docs/content/docs/postgres/meta.json @@ -8,6 +8,8 @@ "npx-create-db", "---Database---", "...database", + "---Infrastructure as Code---", + "...iac", "---Tools & Integrations---", "...integrations", "---More---", From a3d2bdf3de93c9817e49c5dfe0b1728a154a722e Mon Sep 17 00:00:00 2001 From: Aman Varshney Date: Thu, 26 Feb 2026 13:25:01 +0530 Subject: [PATCH 02/11] fix(docs): replace terminal with bash in IaC code blocks --- apps/docs/content/docs/postgres/iac/alchemy.mdx | 4 ++-- apps/docs/content/docs/postgres/iac/pulumi.mdx | 14 +++++++------- apps/docs/content/docs/postgres/iac/terraform.mdx | 12 ++++++------ 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/apps/docs/content/docs/postgres/iac/alchemy.mdx b/apps/docs/content/docs/postgres/iac/alchemy.mdx index e3a5d00709..37c53d47c3 100644 --- a/apps/docs/content/docs/postgres/iac/alchemy.mdx +++ b/apps/docs/content/docs/postgres/iac/alchemy.mdx @@ -44,7 +44,7 @@ Alchemy is a strong fit when: If you follow the Alchemy getting started flow, the common lifecycle is: -```terminal +```bash # create project scaffold (optional) bunx alchemy@latest create --template typescript @@ -77,7 +77,7 @@ For Prisma Postgres-only resources, `configure`/`login` may not be necessary in Alchemy reads Prisma credentials from environment variables by default. -```terminal +```bash export PRISMA_SERVICE_TOKEN="prsc_your_token_here" export ALCHEMY_PASSWORD="choose-a-strong-password" ``` diff --git a/apps/docs/content/docs/postgres/iac/pulumi.mdx b/apps/docs/content/docs/postgres/iac/pulumi.mdx index 8eb4edc314..cf28300016 100644 --- a/apps/docs/content/docs/postgres/iac/pulumi.mdx +++ b/apps/docs/content/docs/postgres/iac/pulumi.mdx @@ -51,7 +51,7 @@ runtime: From your Pulumi project directory, run: -```terminal +```bash pulumi package add terraform-provider registry.terraform.io/prisma/prisma-postgres 0.2.0 ``` @@ -65,7 +65,7 @@ This command: If you are developing the provider locally, you can also add it from a local binary path: -```terminal +```bash pulumi package add terraform-provider /absolute/path/to/terraform-provider-prisma-postgres ``` @@ -77,13 +77,13 @@ Use one of these methods: ### Option A: environment variable -```terminal +```bash export PRISMA_SERVICE_TOKEN="prsc_your_token_here" ``` ### Option B: Pulumi config secret -```terminal +```bash pulumi config set prisma-postgres:serviceToken "prsc_your_token_here" --secret ``` @@ -121,20 +121,20 @@ export const regions = availableRegions; ## 5. Deploy -```terminal +```bash pulumi up ``` To read secret outputs: -```terminal +```bash pulumi stack output connectionString --show-secrets pulumi stack output directUrl --show-secrets ``` ## 6. Clean up -```terminal +```bash pulumi destroy ``` diff --git a/apps/docs/content/docs/postgres/iac/terraform.mdx b/apps/docs/content/docs/postgres/iac/terraform.mdx index 4804485fac..968583201b 100644 --- a/apps/docs/content/docs/postgres/iac/terraform.mdx +++ b/apps/docs/content/docs/postgres/iac/terraform.mdx @@ -47,7 +47,7 @@ The provider currently supports: Set your token as an environment variable: -```terminal +```bash export PRISMA_SERVICE_TOKEN="prsc_your_token_here" ``` @@ -96,27 +96,27 @@ output "direct_url" { Initialize your working directory: -```terminal +```bash terraform init ``` Review and apply: -```terminal +```bash terraform plan terraform apply ``` After apply, retrieve values: -```terminal +```bash terraform output -raw connection_string terraform output -raw direct_url ``` ## 4. Clean up (optional) -```terminal +```bash terraform destroy ``` @@ -147,7 +147,7 @@ output "available_regions" { You can import existing resources into state: -```terminal +```bash terraform import prisma-postgres_project.main terraform import prisma-postgres_database.production terraform import prisma-postgres_connection.api , From cd456688d1d20588f2dbb9ddc236f2a844d153c3 Mon Sep 17 00:00:00 2001 From: Aman Varshney Date: Thu, 26 Feb 2026 13:26:58 +0530 Subject: [PATCH 03/11] fix(docs): remove IaC index page and fix Subsections component error --- apps/docs/content/docs/postgres/iac/index.mdx | 13 ------------- apps/docs/content/docs/postgres/iac/meta.json | 2 +- 2 files changed, 1 insertion(+), 14 deletions(-) delete mode 100644 apps/docs/content/docs/postgres/iac/index.mdx diff --git a/apps/docs/content/docs/postgres/iac/index.mdx b/apps/docs/content/docs/postgres/iac/index.mdx deleted file mode 100644 index 7b52153b28..0000000000 --- a/apps/docs/content/docs/postgres/iac/index.mdx +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: Infrastructure as Code -description: Manage Prisma Postgres with Infrastructure as Code tools like Terraform, Pulumi, and Alchemy. -metaTitle: Infrastructure as Code for Prisma Postgres -metaDescription: Manage Prisma Postgres with Infrastructure as Code tools like Terraform, Pulumi, and Alchemy. -url: /postgres/iac ---- - -Use Infrastructure as Code (IaC) to provision and manage Prisma Postgres resources in a repeatable way with tools like Terraform, Pulumi, and Alchemy. - -## In this section - - diff --git a/apps/docs/content/docs/postgres/iac/meta.json b/apps/docs/content/docs/postgres/iac/meta.json index b27621faa3..c2e5db964f 100644 --- a/apps/docs/content/docs/postgres/iac/meta.json +++ b/apps/docs/content/docs/postgres/iac/meta.json @@ -1,4 +1,4 @@ { "title": "Infrastructure as Code", - "pages": ["index", "terraform", "pulumi", "alchemy"] + "pages": ["terraform", "pulumi", "alchemy"] } From 1bee7f780aeb76830729330c2b51a8175dac99dd Mon Sep 17 00:00:00 2001 From: Aman Varshney Date: Thu, 26 Feb 2026 13:28:36 +0530 Subject: [PATCH 04/11] fix(docs): use npm code block for bun/bunx commands in Alchemy guide --- apps/docs/content/docs/postgres/iac/alchemy.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/docs/content/docs/postgres/iac/alchemy.mdx b/apps/docs/content/docs/postgres/iac/alchemy.mdx index 37c53d47c3..95ffff2657 100644 --- a/apps/docs/content/docs/postgres/iac/alchemy.mdx +++ b/apps/docs/content/docs/postgres/iac/alchemy.mdx @@ -44,7 +44,7 @@ Alchemy is a strong fit when: If you follow the Alchemy getting started flow, the common lifecycle is: -```bash +```npm # create project scaffold (optional) bunx alchemy@latest create --template typescript From 14a3489202994a279989afffa53c841b719f56a0 Mon Sep 17 00:00:00 2001 From: Aman Varshney Date: Thu, 26 Feb 2026 13:34:13 +0530 Subject: [PATCH 05/11] fix(docs): use npm/npx commands in Alchemy workflow code block --- apps/docs/content/docs/postgres/iac/alchemy.mdx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/docs/content/docs/postgres/iac/alchemy.mdx b/apps/docs/content/docs/postgres/iac/alchemy.mdx index 95ffff2657..61b9fb0493 100644 --- a/apps/docs/content/docs/postgres/iac/alchemy.mdx +++ b/apps/docs/content/docs/postgres/iac/alchemy.mdx @@ -46,22 +46,22 @@ If you follow the Alchemy getting started flow, the common lifecycle is: ```npm # create project scaffold (optional) -bunx alchemy@latest create --template typescript +npx alchemy@latest create --template typescript # configure provider profiles/credentials -bun alchemy configure +npm run alchemy configure # authenticate (required for Cloudflare resources) -bun alchemy login +npm run alchemy login # local development with hot reload -bun alchemy dev +npm run alchemy dev # deploy -bun alchemy deploy +npm run alchemy deploy # tear down -bun alchemy destroy +npm run alchemy destroy ``` For Prisma Postgres-only resources, `configure`/`login` may not be necessary in every setup. They are typically needed when you also manage Cloudflare resources in the same app. From 13087e8780b4b656f1c2093b51f0c760a6602bd3 Mon Sep 17 00:00:00 2001 From: Aman Varshney Date: Thu, 26 Feb 2026 13:41:58 +0530 Subject: [PATCH 06/11] fix(docs): split Alchemy workflow into individual npm code blocks --- .../content/docs/postgres/iac/alchemy.mdx | 28 +++++++++++++++---- 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/apps/docs/content/docs/postgres/iac/alchemy.mdx b/apps/docs/content/docs/postgres/iac/alchemy.mdx index 61b9fb0493..cfd028e4e2 100644 --- a/apps/docs/content/docs/postgres/iac/alchemy.mdx +++ b/apps/docs/content/docs/postgres/iac/alchemy.mdx @@ -44,23 +44,39 @@ Alchemy is a strong fit when: If you follow the Alchemy getting started flow, the common lifecycle is: +Create a project scaffold (optional): + ```npm -# create project scaffold (optional) npx alchemy@latest create --template typescript +``` -# configure provider profiles/credentials +Configure provider profiles and credentials: + +```npm npm run alchemy configure +``` + +Authenticate (required for Cloudflare resources): -# authenticate (required for Cloudflare resources) +```npm npm run alchemy login +``` -# local development with hot reload +Start local development with hot reload: + +```npm npm run alchemy dev +``` + +Deploy: -# deploy +```npm npm run alchemy deploy +``` -# tear down +Tear down: + +```npm npm run alchemy destroy ``` From d0973091dc06bbc0eb5a0c852c787525e3ce8e5b Mon Sep 17 00:00:00 2001 From: Aman Varshney Date: Thu, 26 Feb 2026 13:55:31 +0530 Subject: [PATCH 07/11] fix(docs): fix broken management API link and add missing cspell words --- apps/docs/content/docs/postgres/iac/pulumi.mdx | 2 +- apps/docs/content/docs/postgres/iac/terraform.mdx | 2 +- apps/docs/cspell.json | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/docs/content/docs/postgres/iac/pulumi.mdx b/apps/docs/content/docs/postgres/iac/pulumi.mdx index cf28300016..e8ad03917f 100644 --- a/apps/docs/content/docs/postgres/iac/pulumi.mdx +++ b/apps/docs/content/docs/postgres/iac/pulumi.mdx @@ -34,7 +34,7 @@ Pulumi is a strong fit when: - [Pulumi CLI](https://www.pulumi.com/docs/iac/download-install/) - A Pulumi TypeScript project (create one with `pulumi new typescript`) -- A Prisma service token (see [Management API authentication docs](/postgres/introduction/management-api#service-tokens)) +- A Prisma service token (see [Management API authentication docs](/management-api/authentication#service-tokens)) ## 1. Optional: use Bun for dependency installs diff --git a/apps/docs/content/docs/postgres/iac/terraform.mdx b/apps/docs/content/docs/postgres/iac/terraform.mdx index 968583201b..4260b6b8cd 100644 --- a/apps/docs/content/docs/postgres/iac/terraform.mdx +++ b/apps/docs/content/docs/postgres/iac/terraform.mdx @@ -41,7 +41,7 @@ The provider currently supports: - [Terraform](https://developer.hashicorp.com/terraform/install) `>= 1.0` - A Prisma account and workspace in [Prisma Console](https://console.prisma.io) -- A Prisma service token (see [Management API authentication docs](/postgres/introduction/management-api#service-tokens)) +- A Prisma service token (see [Management API authentication docs](/management-api/authentication#service-tokens)) ## 1. Set your service token diff --git a/apps/docs/cspell.json b/apps/docs/cspell.json index 68c2ae16a4..000cc695b4 100644 --- a/apps/docs/cspell.json +++ b/apps/docs/cspell.json @@ -177,6 +177,7 @@ "ossp", "Overfetching", "Pacman", + "packagemanager", "pageinspect", "permitio", "pgbouncer", @@ -211,8 +212,11 @@ "Procfile", "Procfiles", "productid", + "prsc", "psdb", "psql", + "pulumi", + "Pulumi", "qrtrg", "Queenie", "Qwen", From 83fc1f1c47115551c40db020333a9e02e6f7aa56 Mon Sep 17 00:00:00 2001 From: Aman Varshney Date: Thu, 26 Feb 2026 14:07:07 +0530 Subject: [PATCH 08/11] Update apps/docs/content/docs/postgres/iac/alchemy.mdx Co-authored-by: Ankur Datta <64993082+ankur-arch@users.noreply.github.com> --- apps/docs/content/docs/postgres/iac/alchemy.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/docs/content/docs/postgres/iac/alchemy.mdx b/apps/docs/content/docs/postgres/iac/alchemy.mdx index cfd028e4e2..b065cd4cba 100644 --- a/apps/docs/content/docs/postgres/iac/alchemy.mdx +++ b/apps/docs/content/docs/postgres/iac/alchemy.mdx @@ -19,7 +19,7 @@ Alchemy provides Prisma Postgres resources for: ## Conceptual model -Alchemy is a TypeScript library that creates and manages infrastructure when you run it. +[Alchemy](https://alchemy.run/) is a TypeScript library that creates and manages infrastructure when you run it. Instead of a separate declarative config format, you write a normal TypeScript program (commonly `alchemy.run.ts`) and execute it. From 4b6fb1c126daaf34edf622e5bd42e5c64991f388 Mon Sep 17 00:00:00 2001 From: Aman Varshney Date: Thu, 26 Feb 2026 14:07:15 +0530 Subject: [PATCH 09/11] Update apps/docs/content/docs/postgres/iac/pulumi.mdx Co-authored-by: Ankur Datta <64993082+ankur-arch@users.noreply.github.com> --- apps/docs/content/docs/postgres/iac/pulumi.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/docs/content/docs/postgres/iac/pulumi.mdx b/apps/docs/content/docs/postgres/iac/pulumi.mdx index e8ad03917f..eab4edd4c8 100644 --- a/apps/docs/content/docs/postgres/iac/pulumi.mdx +++ b/apps/docs/content/docs/postgres/iac/pulumi.mdx @@ -8,7 +8,7 @@ tocDepth: 3 toc: true --- -Use Pulumi with the Prisma Postgres Terraform provider through the Pulumi Terraform bridge. +Use [Pulumi](https://www.pulumi.com/) with the Prisma Postgres Terraform provider through the Pulumi Terraform bridge. This is the currently supported path for managing Prisma Postgres from Pulumi. From 2ec74f1df83cdf294c116eb37f5da83f6bcc37c1 Mon Sep 17 00:00:00 2001 From: Aman Varshney Date: Thu, 26 Feb 2026 14:07:31 +0530 Subject: [PATCH 10/11] Update apps/docs/content/docs/postgres/iac/alchemy.mdx Co-authored-by: Ankur Datta <64993082+ankur-arch@users.noreply.github.com> --- apps/docs/content/docs/postgres/iac/alchemy.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/docs/content/docs/postgres/iac/alchemy.mdx b/apps/docs/content/docs/postgres/iac/alchemy.mdx index b065cd4cba..31eeb8e321 100644 --- a/apps/docs/content/docs/postgres/iac/alchemy.mdx +++ b/apps/docs/content/docs/postgres/iac/alchemy.mdx @@ -84,7 +84,7 @@ For Prisma Postgres-only resources, `configure`/`login` may not be necessary in ## Prerequisites -- An Alchemy project +- An [Alchemy project](https://alchemy.run/) - A Prisma service token - `PRISMA_SERVICE_TOKEN` configured in your environment - `ALCHEMY_PASSWORD` configured when your resources contain secrets From 1bf5765790ac781106cad6612d33eaea095299de Mon Sep 17 00:00:00 2001 From: Aman Varshney Date: Thu, 26 Feb 2026 14:12:58 +0530 Subject: [PATCH 11/11] docs(postgres): move IaC section below Tools & Integrations in sidebar --- apps/docs/content/docs/postgres/meta.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/docs/content/docs/postgres/meta.json b/apps/docs/content/docs/postgres/meta.json index a7987bb803..35ab3063f9 100644 --- a/apps/docs/content/docs/postgres/meta.json +++ b/apps/docs/content/docs/postgres/meta.json @@ -8,10 +8,10 @@ "npx-create-db", "---Database---", "...database", - "---Infrastructure as Code---", - "...iac", "---Tools & Integrations---", "...integrations", + "---Infrastructure as Code---", + "...iac", "---More---", "error-reference", "troubleshooting",