---
title: "Crossplane"
description: "Manage PgBeam projects, databases, replicas, custom domains, cache rules, spend limits, agent credentials, policy profiles, webhook endpoints, self host enrollments, and honeytokens as Kubernetes custom resources using the Crossplane provider."
canonical: "https://pgbeam.com/docs/crossplane"
last-updated: "2026-09-14T19:37:21.000Z"
---

# Crossplane

> Manage PgBeam projects, databases, replicas, custom domains, cache rules, spend limits, agent credentials, policy profiles, webhook endpoints, self host enrollments, and honeytokens as Kubernetes custom resources using the Crossplane provider.

URL: https://pgbeam.com/docs/crossplane

Manage your PgBeam infrastructure as Kubernetes custom resources with Crossplane. The `provider-pgbeam` package provides managed resources for projects, databases, replicas, custom domains, cache rules, spend limits, agent credentials, policy profiles, webhook endpoints, self host enrollments, and honeytokens.

## Setup

## Install the provider

The Crossplane provider is coming soon. Registry publishing is on the roadmap.

## Configure credentials

Create a Secret with your PgBeam API key, then reference it in a ProviderConfig:

## Create a project

## Apply

Crossplane creates the PgBeam project and its primary database atomically. The proxy hostname is available in `status.atProvider.proxyHost` and published to the connection secret.

## Resources

**Approval and anomaly rules are not yet managed as code.** Policy profiles
and honeytokens are managed resources, so the enforcement rules and the decoys
live in your reviewed IaC flow and are covered by drift detection. Approval
rules and anomaly rules are not: the API exposes them only as events to review
after the fact (approve/reject, ack/resolve), so there is nothing to declare
yet. Those two still live outside IaC.

## Project

Manages a PgBeam project with a primary database.

**Status:** `proxyHost`, `queriesPerSecond`, `burstSize`, `maxConnections`, `databaseCount`, `activeConnections`, `createdAt`, `updatedAt`, `primaryDatabaseID`

## Database

Manages an upstream database connection within a PgBeam project.

**Status:** `connectionString`, `createdAt`, `updatedAt`

## Replica

Manages a read replica for a PgBeam database.

Replicas are immutable; any spec change triggers recreation.

**Status:** `createdAt`, `updatedAt`

## CustomDomain

Manages a custom domain for a PgBeam project.

CustomDomains are immutable; any spec change triggers recreation.

**Status:** `verified`, `verifiedAt`, `tlsCertExpiry`, `dnsVerificationToken`, `dnsInstructions`, `createdAt`, `updatedAt`

## CacheRule

Manages a per-query cache rule. Deletion disables caching (soft-delete).

**Status:** `queryHash`, `normalizedSQL`, `queryType`, `callCount`, `avgLatencyMs`, `p95LatencyMs`, `avgResponseBytes`, `stabilityRate`, `recommendation`, `firstSeenAt`, `lastSeenAt`

## SpendLimit

Manages the monthly spend limit for an organization.

**Status:** `orgID`, `plan`, `billingProvider`, `subscriptionStatus`, `currentPeriodEnd`, `enabled`, `customPricing`, `spendCapped`, `spendCappedAt`, `limits`, `createdAt`, `updatedAt`

## AgentCredential

Manages a scoped agent credential (a PgBeam-issued Postgres login plus a hosted MCP token) for an AI agent. The connection string and MCP token are one-time secrets returned only at creation and exposed as sensitive computed outputs; they cannot be retrieved again. To rotate the secrets, taint/replace the resource (or use the rotate endpoint out of band).

**Status:** `pgUsername`, `authMethod`, `lastUsedAt`, `createdAt`, `updatedAt`, `connectionString`, `mcpURL`, `mcpToken`

## PolicyProfile

Manages a policy profile: a named bundle of agent-gateway enforcement rules (access mode, table allow/deny lists, statement-kind rules, PII masking rules, per-relation row filters, query/egress budgets, write mode, approvals, and migration safety) attached to agent credentials and enforced in the PG wire protocol. Nested-list fields (masking\_rules, row\_filters) and the nested statement\_rules object are expressed as structured config.

**Status:** `createdAt`, `updatedAt`

## WebhookEndpoint

Manages a webhook endpoint that receives project audit and anomaly event deliveries. The signing secret is write-only and never returned by the API.

**Status:** `createdAt`, `updatedAt`

## SelfHostEnrollment

Manages a self-host (BYOC) enrollment: a token a self-hosted proxy uses to authenticate to the control plane's config/audit stream. The token is a one-time secret returned only at creation and exposed as a sensitive computed output; it cannot be retrieved again. To rotate the token, replace the resource. Deletion revokes the enrollment.

SelfHostEnrollments are immutable; any spec change triggers recreation.

**Status:** `createdBy`, `createdAt`, `lastSeenAt`, `revokedAt`, `token`

## Honeytoken

Manages a honeytoken: a decoy (canary) relation that no legitimate query should ever touch. Any agent statement referencing it is blocked and recorded as a canary\_tripped audit event; the kill action additionally disables the tripping credential via the kill-switch. The relation does not have to exist in the upstream database: enforcement is by name, in the wire protocol, before the statement reaches Postgres.

**Status:** `createdAt`, `updatedAt`

## Configuration

Setting

Source

Description

`apiKeySecretRef`

ProviderConfig

Secret reference for the API key

`baseUrl`

ProviderConfig

API base URL (default: `https://api.pgbeam.com`)

## Replacement vs update

Some spec changes trigger resource recreation rather than in-place updates:

Resource

Recreation triggers

Project

`orgID`, `cloud`, `selfHosted`

Database

`projectID`

Replica

Any spec change (immutable)

CustomDomain

Any spec change (immutable)

CacheRule

`projectID`, `databaseID`, `queryHash`

SpendLimit

`orgID`

AgentCredential

`projectID`, `policyProfileID`, `name`, `principalType`, `expiresAt`

PolicyProfile

`projectID`

WebhookEndpoint

`projectID`

SelfHostEnrollment

Any spec change (immutable)

Honeytoken

`projectID`

## Further reading

Connection Pooling: pool modes and sizing

Caching: query caching and SWR

Read Replicas: replica routing

Custom Domains: DNS setup and verification

API Keys: managing API credentials

Plans: plan limits and pricing