@@ -12,38 +12,47 @@ npm install @pgbeam/pulumi
1212
1313## Usage
1414
15+ A project is created together with its primary database in one call, so pass the
16+ upstream connection as the required ` database ` object. A project has no ` region ` ;
17+ PgBeam serves every project from every region and routes each client to the
18+ nearest one automatically.
19+
1520``` typescript
21+ import * as pulumi from " @pulumi/pulumi" ;
1622import * as pgbeam from " @pgbeam/pulumi" ;
1723
24+ const config = new pulumi .Config ();
25+
1826const project = new pgbeam .Project (" my-project" , {
1927 name: " my-project" ,
2028 orgId: " org_123" ,
21- region: " us-east-1" ,
22- });
23-
24- const database = new pgbeam .Database (" primary" , {
25- projectId: project .id ,
26- name: " primary" ,
27- host: " your-db-host.example.com" ,
28- port: 5432 ,
29- database: " mydb" ,
30- username: " dbuser" ,
31- password: config .requireSecret (" dbPassword" ),
29+ database: {
30+ host: " your-db-host.example.com" ,
31+ port: 5432 ,
32+ name: " mydb" ,
33+ username: " dbuser" ,
34+ password: config .requireSecret (" dbPassword" ),
35+ sslMode: " require" ,
36+ },
3237});
3338```
3439
40+ To attach more databases later (for example a read replica), use the standalone
41+ ` pgbeam.Database ` resource with its own ` projectId ` , ` name ` , and credentials.
42+
3543## Resources
3644
37- | Resource | Description |
38- | ------------------------ | ------------------------------------ |
39- | ` pgbeam.Project ` | PgBeam project |
40- | ` pgbeam.Database ` | PostgreSQL database connection |
41- | ` pgbeam.Replica ` | Read replica configuration |
42- | ` pgbeam.CustomDomain ` | Custom domain for connection strings |
43- | ` pgbeam.CacheRule ` | Query caching rule |
44- | ` pgbeam.SpendLimit ` | Budget controls |
45- | ` pgbeam.AgentCredential ` | Scoped agent credential |
46- | ` pgbeam.WebhookEndpoint ` | Event delivery endpoint |
45+ | Resource | Description |
46+ | ------------------------ | ---------------------------------------------------------- |
47+ | ` pgbeam.Project ` | PgBeam project |
48+ | ` pgbeam.Database ` | PostgreSQL database connection |
49+ | ` pgbeam.Replica ` | Read replica configuration |
50+ | ` pgbeam.CustomDomain ` | Custom domain for connection strings |
51+ | ` pgbeam.CacheRule ` | Query caching rule |
52+ | ` pgbeam.SpendLimit ` | Budget controls |
53+ | ` pgbeam.AgentCredential ` | Scoped agent credential |
54+ | ` pgbeam.WebhookEndpoint ` | Event delivery endpoint |
55+ | ` pgbeam.PolicyProfile ` | Policy profile (access mode, allowlists, masking, budgets) |
4756
4857## Agent gateway
4958
@@ -81,20 +90,28 @@ export const agentMcpToken = agent.mcpToken;
8190> resource (` pulumi up ` after ` pulumi state delete ` / a ` replaceOnChanges ` -style
8291> change to a ` name ` /immutable input).
8392
84- > ** Policy profiles are not yet managed as code.** ` policyProfileId ` (above, and
85- > ` defaultPolicyProfileId ` on a ` Project ` ) is the ID of a policy profile that
86- > must be created out of band with ` pgbeam policies create ` or the dashboard —
87- > there is no ` PolicyProfile ` resource yet. The policy itself, the most
88- > security-sensitive primitive, therefore lives outside your reviewed IaC flow
89- > and is invisible to ` pulumi preview ` drift detection.
93+ Manage policies as code with the ` pgbeam.PolicyProfile ` resource, then pass its
94+ ` id ` wherever a profile is required (` policyProfileId ` above, or
95+ ` defaultPolicyProfileId ` on a ` Project ` to enforce a profile on
96+ passthrough/human connections):
97+
98+ ``` typescript
99+ const readOnly = new pgbeam .PolicyProfile (" read-only" , {
100+ projectId: project .id ,
101+ name: " read-only" ,
102+ accessMode: " read_only" ,
103+ });
104+ ```
105+
106+ Keeping the profile in Pulumi puts the most security-sensitive primitive under
107+ ` pulumi preview ` drift detection.
90108
91109## Authentication
92110
93- Set the ` PGBEAM_API_TOKEN ` environment variable or configure it via Pulumi
94- config:
111+ Set the ` PGBEAM_API_KEY ` environment variable or configure it via Pulumi config:
95112
96113``` bash
97- pulumi config set pgbeam:apiToken --secret your-api-token
114+ pulumi config set pgbeam:apiKey --secret your-api-key
98115```
99116
100117## Documentation
0 commit comments