You deploy a new web service and need TLS, routing, and access policies set up before lunch. Caddy can handle HTTPS automatically, yet you still need to declare routes, secrets, and certificates somewhere consistent. Pulumi gives you that declarative infrastructure model, wired through code. Together, Caddy Pulumi can make dynamic site delivery feel like editing configuration with superpowers.
Caddy is a fast, Go-based web server that configures itself with HTTPS via Let’s Encrypt. Pulumi is infrastructure-as-code that compiles down to cloud-native resources. When you combine them, you get a practical bridge between app delivery and repeatable infrastructure automation. Instead of configuring servers manually, you define and deploy Caddy's setup directly from Pulumi in a versioned, auditable stack.
Here’s the logic. Pulumi manages the environment: load balancers, DNS, secrets in AWS Secrets Manager, or IP policies in Cloudflare. Caddy runs on top, serving traffic with live certificates and identity-based routing. Using Pulumi to spin up Caddy instances locks the entire flow into your CI/CD pipeline. Each push updates infra, refreshes certs, and maintains consistent configuration across environments.
Authentication is the trickiest part to get right. You may need to align OpenID Connect (OIDC) tokens from Okta or Google Workspace to Caddy’s reverse proxy routes. Pulumi can handle those values securely, inject them at runtime, and ensure nothing leaks in plain text. The result is infrastructure that adapts to identity without compromising speed.
A few solid practices emerge:
- Keep Caddyfile templates minimal and inject variables from Pulumi’s stack config to reduce drift.
- Use Pulumi’s secrets provider for TLS keys, not raw environment variables.
- Run Pulumi previews during pull requests so reviewers can see routing diffs.
- Audit identity policies just like code, especially when mapping RBAC groups to Caddy endpoints.
The result is a deployment pipeline that feels automatic yet stays under your control. No hand-edited configs, no lost certs, no waiting for IAM approvals.