Cloudflare.VpcService reference
VpcService
Section titled “VpcService”Source:
src/Cloudflare/VpcService/VpcService.ts
A Cloudflare VPC service that exposes a private host (IP or hostname) reachable through a Cloudflare Tunnel for Workers VPC.
VpcService: Creating a VPC Service
Section titled “VpcService: Creating a VPC Service”Hostname through a tunnel
const tunnel = yield* Cloudflare.Tunnel.Tunnel("MyTunnel");const service = yield* Cloudflare.VpcService.VpcService("Internal", { host: { hostname: "internal.example.com", resolverNetwork: { tunnelId: tunnel.tunnelId, resolverIps: ["10.0.0.53"] }, },});IPv4 with explicit ports
const service = yield* Cloudflare.VpcService.VpcService("DevServer", { httpPort: 5173, host: { ipv4: "192.168.1.100", network: { tunnelId: tunnel.tunnelId } },});lookup
Section titled “lookup”Source:
src/Cloudflare/VpcService/VpcServiceLookup.ts
Look up an existing Cloudflare VPC service (managed outside this stack)
without managing its lifecycle — the data-source form (what Terraform
calls a data source and Pulumi an invoke). Reads the service by
serviceId or name and returns an Output of its Attributes,
resolved during plan/deploy and inert inside deployed bundles. Place it
in a Worker’s env to attach a vpc_service binding.
lookup: Examples
Section titled “lookup: Examples”Look up by ID
const service = Cloudflare.VpcService.lookup({ serviceId: "123e4567-e89b-12d3-a456-426614174000",});Look up by name
const service = Cloudflare.VpcService.lookup({ name: "my-vpc-service" });Bind to a Worker
const worker = yield* Cloudflare.Worker("Worker", { main: "./src/worker.ts", env: { VPC: Cloudflare.VpcService.lookup({ name: "my-vpc-service" }) },});