# Cloudflare-First Networking as Code with Pulumi

DevFeed: [Cloudflare-First Networking as Code with Pulumi](<https://devfeed.tech/articles/cloudflare-first-networking-as-code-with-pulumi-18992.md>)

Original publisher: [Read original article](<https://www.pulumi.com/blog/cloudflare-first-networking-with-pulumi/>)

Author: Pablo Seibelt

Published: 2026-06-23T00:00:00Z

Content type: tutorial

Language: en

Sources: [Pulumi](<https://devfeed.tech/sources/pulumi.md>)

Topics: [Cloudflare](<https://devfeed.tech/topics/cloudflare.md>), [networking](<https://devfeed.tech/topics/networking.md>), [Security](<https://devfeed.tech/topics/security.md>), [configuration](<https://devfeed.tech/topics/configuration.md>), [Provisioning](<https://devfeed.tech/topics/provisioning.md>), [Cloudflare Access](<https://devfeed.tech/topics/cloudflare-access.md>)

Tags: [ci-cd](<https://devfeed.tech/tags/ci-cd.md>), [cloudflare](<https://devfeed.tech/tags/cloudflare.md>), [cloudflare-access](<https://devfeed.tech/tags/cloudflare-access.md>), [configuration](<https://devfeed.tech/tags/configuration.md>), [infrastructure](<https://devfeed.tech/tags/infrastructure.md>), [networking](<https://devfeed.tech/tags/networking.md>), [pulumi](<https://devfeed.tech/tags/pulumi.md>), [routing](<https://devfeed.tech/tags/routing.md>), [security](<https://devfeed.tech/tags/security.md>), [tutorials](<https://devfeed.tech/tags/tutorials.md>), [typescript](<https://devfeed.tech/tags/typescript.md>), [zero-trust](<https://devfeed.tech/tags/zero-trust.md>)

## AI overview

This tutorial shows how to define a standardized Cloudflare edge baseline with Pulumi and TypeScript for multi-cloud applications. It covers DNS records, WAF custom rules, a Worker canary, and Cloudflare Access policies, followed by validation steps for the deployed configuration.

## Source excerpt

Platform teams managing multi-cloud applications face a dangerous visibility gap. While origin infrastructure is tightly controlled, the edge configuration often drifts through manual console tweaks. DNS records point to stale origins, WAF rules are inconsistent across environments, and Zero Trust policies fail to keep pace with team changes. This edge drift leads to application exposure or routing failures that origin teams only notice after users report them. As applications span multiple clouds, the edge often becomes the most consistent layer for enforcing security and traffic policies. The cost of waiting for a unified edge strategy is high. Every manual change is a potential security hole or a performance bottleneck that bypasses your standard CI/CD rigor. What you'll build In this post, you will build a standardized Cloudflare edge baseline. You'll use Pulumi to define: DNS records to point to your multi-cloud origins. WAF custom rules to block malicious traffic before it hits your network. A Worker canary to handle edge logic and header validation. Zero Trust Access policies to secure internal tools and origin access. By the end, you will have a version-controlled edge that you can validate and deploy across any environment. The Pulumi program We'll build a Pulumi program that sets up a complete edge environment. This approach ensures that your edge security and routing are always in sync with your application code. Setting up the provider First, ensure you have the @pulumi/cloudflare package installed and your credentials configured. The examples below are checked against @pulumi/cloudflare@6.15.0, the current v6 Pulumi Registry API at the time of writing. npm install @pulumi/cloudflare@6.15.0 pulumi config set --secret cloudflare:apiToken "$CLOUDFLARE_API_TOKEN" Defining the infrastructure Here is the complete Pulumi program in TypeScript. If your zone already has a custom WAF ruleset for the same phase, import that ruleset or add the rule to your existing