Skip to content

Commit 3bce515

Browse files
nyobeclaude
andcommitted
Updated blog post with a deployable adapter example
Co-Authored-By: Claude <[email protected]>
1 parent 3766db0 commit 3bce515

File tree

1 file changed

+26
-28
lines changed

1 file changed

+26
-28
lines changed

content/blog/esc-connect/index.md

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Pulumi ESC has [native integrations](/docs/esc/integrations/) with popular secre
2020

2121
ESC Connect changes this by letting you build simple HTTPS adapter services using the [`external` provider](/docs/esc/integrations/dynamic-secrets/external/). Your adapter handles requests from ESC, fetches secrets from your custom source, and returns them. ESC handles authentication with signed JWT tokens, so you get fine-grained control over access without building a complete security infrastructure.
2222

23-
## Building an Adapter
23+
## Building an adapter
2424

2525
Here's an [ESC environment](/docs/esc/environments/) configuration that uses ESC Connect:
2626

@@ -33,38 +33,32 @@ values:
3333
secretName: DATABASE_PASSWORD
3434
```
3535
36-
When you open this environment, ESC makes an authenticated POST request to your adapter. Your adapter validates the JWT token, fetches the secret from your source, and returns it:
36+
When you open this environment, ESC makes an authenticated POST request to your adapter.
37+
Your adapter validates the JWT token, fetches the secret from your source, and returns it:
3738
38-
```python
39-
# Simplified example - see docs for complete implementation
40-
class AdapterHandler(BaseHTTPRequestHandler):
41-
def do_POST(self):
42-
# Verify JWT token from Authorization header
43-
token = self.headers.get("Authorization", "").replace("Bearer ", "")
44-
claims = verify_jwt(token) # Validates signature, expiration, audience
39+
```typescript
40+
const handler = async (event) => {
41+
// 1. Validate JWT from Authorization header
42+
const claims = await validateJWT(event.headers.Authorization);
4543

46-
# Parse request and fetch secret
47-
request = json.loads(self.rfile.read())
48-
secret_value = fetch_from_your_source(request["secretName"])
44+
// 2. Verify audience and body hash for security
45+
verifyAudience(claims.aud, event.url);
46+
verifyBodyHash(event.body, claims.body_hash);
4947

50-
# Return response
51-
response = {"value": secret_value}
52-
self.send_response(200)
53-
self.wfile.write(json.dumps(response).encode())
54-
```
55-
56-
Once deployed, the secrets become available in your ESC environment:
48+
// 3. Fetch secret from your source
49+
const request = JSON.parse(event.body);
50+
const secret = await fetchFromYourSource(request.secretName);
5751

58-
```yaml
59-
environmentVariables:
60-
DB_PASSWORD: ${customSecrets.response.value}
52+
// 4. Return the secret
53+
return { statusCode: 200, body: JSON.stringify(secret) };
54+
};
6155
```
6256

63-
The [documentation](/docs/esc/integrations/dynamic-secrets/external/) includes complete adapter examples with JWT verification, body hash validation, and security best practices.
57+
The [example reference implementation](#try-it-out) includes an `ESCRequestValidator` class that handles JWT verification and request integrity checking for you. See the [documentation](/docs/esc/integrations/dynamic-secrets/external/) for detailed security requirements and examples in other languages.
6458

65-
## Automated Rotation
59+
## Automated rotation
6660

67-
ESC Connect also supports [automated secret rotation](/docs/esc/environments/rotation/) through `fn::rotate::external`. Your rotation adapter receives the current credential state, generates new credentials, updates your target system, and returns the new state. ESC handles scheduling and maintains both current and previous credentials during transitions for zero-downtime rotation.
61+
ESC Connect also supports automated secret rotation through [`fn::rotate::external`](/docs/esc/integrations/rotated-secrets/external/). Your rotation adapter receives the current credential state, generates new credentials, updates your target system, and returns the new state. ESC handles scheduling and maintains both current and previous credentials during transitions for zero-downtime rotation.
6862

6963
```yaml
7064
values:
@@ -77,10 +71,14 @@ values:
7771
environment: production
7872
```
7973
80-
The [rotation documentation](/docs/esc/integrations/rotated-secrets/external/) covers state management, dual-secret strategies, and implementation patterns.
74+
Learn more about [secret rotation in Pulumi ESC](/docs/esc/environments/rotation/) and the [external rotator implementation patterns](/docs/esc/integrations/rotated-secrets/external/).
75+
76+
## Try it out
77+
78+
ESC Connect is available now in Pulumi ESC. We've created a [deployable reference adapter implementation](https://github.com/pulumi/examples/tree/master/aws-ts-esc-external-adapter-lambda) on AWS Lambda that demonstrates secure request validation:
8179
82-
## Try It Out
80+
[![Deploy this example with Pulumi](https://get.pulumi.com/new/button.svg)](https://app.pulumi.com/new?template=https://github.com/pulumi/examples/blob/master/aws-ts-esc-external-adapter-lambda/README.md)
8381
84-
ESC Connect is available now in Pulumi ESC. Check out the documentation for the [external provider](/docs/esc/integrations/dynamic-secrets/external/) and [external rotation](/docs/esc/integrations/rotated-secrets/external/) to get started. The docs include complete adapter examples with JWT verification, security best practices, and example implementations in multiple languages.
82+
Check out the documentation for the [external provider](/docs/esc/integrations/dynamic-secrets/external/) and [external rotator](/docs/esc/integrations/rotated-secrets/external/) to learn more about building production adapters.
8583
8684
To learn more about Pulumi ESC, explore the [ESC documentation](/docs/esc/) or [get started for free](/docs/esc/get-started/). If you build an adapter for a system that others might find useful, share it in the [Pulumi Community Slack](https://slack.pulumi.com) — we'd love to see what you build.

0 commit comments

Comments
 (0)